JayX JayX - 5 months ago 34
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