Ruby Method of the Day - String.rstrip!
Signature
string.rstrip! #=> string or nil
String.rstrip! is the in-place edit version of
String.rstrip.
string.rstrip! returns string with trailing whitespace removed from
string or it returns nil if no trailing whitespace was found.
Examples
1 2 3 4 5 6 |
str = "foo bar \r\n\t" #=> "foo bar \r\n\t" str.rstrip! #=> "foo bar" str == "foo bar \r\n\t" #=> false str == "foo bar" #=> true str.rstrip! #=> nil |
