SyntaxFix
Write A Post
Hire A Developer
Questions
If it is a the end of the string, you can also use chomp:
chomp
"hello".chomp("llo") #=> "he"