Method: String#rstrip!
- Defined in:
- string.c
#rstrip! ⇒ self?
Like String#rstrip, except that any modifications are made in self; returns self if any modification are made, nil otherwise.
Related: String#lstrip!, String#strip!.
10340 10341 10342 10343 10344 10345 10346 10347 10348 10349 10350 10351 10352 10353 10354 10355 10356 10357 10358 10359 |
# File 'string.c', line 10340 static VALUE rb_str_rstrip_bang(VALUE str) { rb_encoding *enc; char *start; long olen, roffset; str_modify_keep_cr(str); enc = STR_ENC_GET(str); RSTRING_GETMEM(str, start, olen); roffset = rstrip_offset(str, start, start+olen, enc); if (roffset > 0) { long len = olen - roffset; STR_SET_LEN(str, len); TERM_FILL(start+len, rb_enc_mbminlen(enc)); return str; } return Qnil; } |