tr_s

str.tr_s(from_str, to_str) â new_str
Instance Public methods

Processes a copy of str as described under String#tr, then removes duplicate characters in regions that were affected by the translation.

1
2
3
"hello".tr_s('l', 'r')     #=> "hero"
"hello".tr_s('el', '*')    #=> "h*o"
"hello".tr_s('el', 'hx')   #=> "hhxo"
doc_ruby_on_rails
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.