delete_suffix(p1)
Returns a copy of str with trailing suffix deleted.
"hello".delete_suffix("llo") #=> "he" "hello".delete_suffix("hel") #=> "hello"
static VALUE rb_str_delete_suffix(VALUE str, VALUE suffix) { long suffixlen; suffixlen = deleted_suffix_length(str, suffix); if (suffixlen <= 0) return rb_str_dup(str); return rb_str_subseq(str, 0, RSTRING_LEN(str) - suffixlen); }