Opposite of chomp in Ruby
There does not seem to be an existing function which does the opposite of ‘chomp’ in Ruby in the standard library.
If you’d like to use a function to remove a specific substring from the beginning of a string, try this core extension. Note: This doesn’t do any magic with whitespace as chomp does.
len = string_to_remove.size
if self[0..(len-1)] == string_to_remove