Ruby Method of the Day - String.lstrip
Signature
string.lstrip #=> new_string
string.lstrip returns a new string with leading whitespace removed.
Examples
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
"\r\n\t foo bar".lstrip #=> "foo bar" text = <<-'END' Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut ac nulla. Duis sed est. Praesent at dui et velit tempor cursus. Morbi purus tortor, tempus tincidunt, placerat sit amet, dignissim quis, nulla. Duis ipsum. Proin fringilla. END # Prints out each line of the paragraph above with # leading whitespace removed. text.each_line {|l| print l.lstrip } |
