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