mutant icon indicating copy to clipboard operation
mutant copied to clipboard

Mutate `str.tr_s(pattern, '')` → `str.delete(pattern)`

Open backus opened this issue 4 years ago • 0 comments

These are equivalent:

'222-333-4444'.tr_s('^0-9', '') # => "2223334444"
'222-333-4444'.delete('^0-9')   # => "2223334444"

Could probably also do that for String#tr. Honestly, I don't know the difference between tr and tr_s even after rereading the Ruby docs

backus avatar Nov 17 '21 22:11 backus