String#tr - Problem in Code or Documentation?

  • Thread starter Wolfgang Nádasi-Donner
  • Start date
W

Wolfgang Nádasi-Donner

Moin, moin!

The description for "tr" does not state what should happen, if the
second string ist an empty string. In the actual implementation all
character from the object string will be deleted, if they appear in the
first parameter string.
irb(main):001:0> 'Hello, world!'.tr('aeiou','')
=> "Hll, wrld!"
My question is: Is this an Error in the implementation or a special
case, which is not documented?

Wolfgang Nádasi-Donner
 
W

Wolfgang Nádasi-Donner

Felix said:
If an empty string is passed on as the to_str, simply return the C
equivalent of String#delete(from_str).

Hope that _does_ help this time,

Fine - thank you very much! It means, that it is done by intention.

WoNáDo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,162
Latest member
GertrudeMa
Top