[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

String#tr - Problem in Code or Documentation?

Wolfgang Nádasi-donner

8/26/2007 10:38:00 AM

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.

>>>>> Example >>>>>
irb(main):001:0> 'Hello, world!'.tr('aeiou','')
=> "Hll, wrld!"
>>>>> EoE >>>>>

My question is: Is this an Error in the implementation or a special
case, which is not documented?

Wolfgang Nádasi-Donner
--
Posted via http://www.ruby-....

1 Answer

Wolfgang Nádasi-donner

8/26/2007 12:45:00 PM

0

Felix Windt wrote:
> 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
--
Posted via http://www.ruby-....