JayX JayX - 1 month ago 8
Ruby Question

How do I remove substring after a certain character in a string using Ruby?

I guess it's an easy question

How do I do this?

Answer
new_str = str.slice(0..(str.index('blah')))

alt text