解决方法
lstrip似乎是你想要的(假设应该保留尾随的空格):
>> s = "\naaaa\nbbbb" #=> "\naaaa\nbbbb" >> s.lstrip #=> "aaaa\nbbbb"
从文档:
Returns a copy of str with leading whitespace removed. See also
String#rstrip and String#strip.