Ruby Newbie homepage Ruby Newbie homepage

How to use

Quick guide

Official content
Processes a copy of str as described under String#tr, then removes duplicate characters in regions that were affected by the translation.
"hello".tr_s('l', 'r')     #=> "hero"
"hello".tr_s('el', '*')    #=> "h*o"
"hello".tr_s('el', 'hx')   #=> "hhxo"
               static VALUE
rb_str_tr_s(VALUE str, VALUE src, VALUE repl)
    str = str_duplicate(rb_cString, str);
    tr_trans(str, src, repl, 1);
    return str;

Was this page useful?