Actions
Bug #19769
closedRange of size 1 in String#tr causes unexpected behavior
    Bug #19769:
    Range of size 1 in String#tr causes unexpected behavior
  
Description
Hi,
I noticed a possible unexpected behavior in String#tr.
Is that intentional?
'ABC'.tr 'A-AB', 'XY'   # => "YYC"
I would expect the same result as:
'ABC'.tr 'AB', 'XY'     # => "XYC"
The tr utility does exactly that:
echo ABC | tr A-AB XY   # => "XYC"
The letter 'A' is interpreted 2 times in that case, shifting by 1 all the replacement string.
(I found this related https://bugs.ruby-lang.org/issues/1953)
Actions