JayX JayX - 4 months ago 29
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