String.strip
Signature
string.strip #=> new_string
The String.strip method is in the same family of methods as String.lstrip and String.rstrip.
string.strip returns a new string with the leading and trailing whitespace
removed.
Examples
"foo bar \r\n\t".strip #=> "foo bar"
"\r\n\t foo bar".strip #=> "foo bar"
"\r\n\t foo bar \r\n\t".strip #=> "foo bar"
text =
Documentation Reference
- Log in to post comments
