def chomp(sep = $/) "ruby\n".chomp #=> "ruby" end
Returns a new string with the trailing newline removed.
Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
Raised by Encoding and String methods when the source encoding is incompatible with the target encoding.
Encoding
String