Skip to content

Mutate str.tr_s(pattern, '')str.delete(pattern) #1286

Open
@backus

Description

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions