rails remove last character from string code example Example: ruby remove last element of string Click to copy'abc1234'.chomp(4) # => 'abc123' 'toto'.chomp('to') # => 'to'