lstrip()
public
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".lstrip
Show source
static VALUE
rb_str_lstrip(VALUE str)
{
char *start;
long len, loffset;
RSTRING_GETMEM(str, start, len);
loffset = lstrip_offset(str, start, start+len, STR_ENC_GET(str));
if (loffset <= 0) return rb_str_dup(str);
return rb_str_subseq(str, loffset, len - loffset);
}