Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
String#tr_s!
(::String::selector source, ::string replacement) -> self?
tr_s!(selector, replacements) → self or nil
string.c
View on GitHub ↗
static VALUE
rb_str_tr_s_bang(VALUE str, VALUE src, VALUE repl)
{
return tr_trans(str, src, repl, 1);
}
Like String#tr_s, but modifies self in place. Returns self if any changes were made, nil otherwise.
Related: String#squeeze!.