Removes leading and trailing whitespace from str. Returns nil
if str was not altered.
Refer to strip
for the definition of whitespace.
Returns a copy of str with leading whitespace removed. See also String#rstrip
and String#strip
.
Refer to strip
for the definition of whitespace.
" hello ".lstrip #=> "hello " "hello".lstrip #=> "hello"
Returns a copy of str with trailing whitespace removed. See also String#lstrip
and String#strip
.
Refer to strip
for the definition of whitespace.
" hello ".rstrip #=> " hello" "hello".rstrip #=> "hello"
Removes leading whitespace from str, returning nil
if no change was made. See also String#rstrip!
and String#strip!
.
Refer to strip
for the definition of whitespace.
" hello ".lstrip! #=> "hello " "hello ".lstrip! #=> nil "hello".lstrip! #=> nil
Removes trailing whitespace from str, returning nil
if no change was made. See also String#lstrip!
and String#strip!
.
Refer to strip
for the definition of whitespace.
" hello ".rstrip! #=> " hello" " hello".rstrip! #=> nil "hello".rstrip! #=> nil
Returns underlying String object, the subject of IO
.