I have the following line:
"h3. My Title Goes Here"
I basically want to remove the first four characters from the string, just to return:
"My Title Goes Here".
The thing is, I am repeating an array of strings, and not everyone has a h3. part h3. ahead, so I can't just drop the first four characters blindly.
I checked the docs and the closest thing I could find was chomp , but this only works for the end of the line.
Now I am doing this:
"h3. My Title Goes Here".reverse.chomp(" .3h").reverse
This gives me my desired result, but there should be a better way. I do not want to change the line twice for no reason. Is there any other way that will work?
James source share