Say I have a sentence similar to the following:
The quick brown fox jumps over the lazy dog
I'd like to slice off everything before and including "jumps", so I am left with:
over the lazy dog
Currently, I get the index of the part I'd like to remove, then add the length of that part to it, and then slice it, as such:
sentence = "The quick brown fox jumps over the lazy dog"
slice_index = sentence.index("jumps").to_i + sentence.size
sliced_sentence = sentence.slice(slice_index..-1)
Is there a better way of achieving this?
Thanks!