From: Robert Klemme Date: 2005-03-22T00:19:59+09:00 Subject: Re: string.tr and \ "Christian Neukirchen" schrieb im Newsbeitrag news:m2mzsxvxyl.fsf@lilith.local... > "Robert Klemme" writes: > > > "Tom Counsell" schrieb im Newsbeitrag > > news:193f68dcbb7799e1110cab8eb7a02248@cam.ac.uk... > >> Hello > >> > >> I'm a little confused and would appreciate your help. I would like to > >> remove any \ characters from a string as well as some other characters. > >> > > > > You're abusing String#tr - this method is intended to replace single chars > > by other single chars. That you can remove characters is a special case > > with empty replacement strings. You really should be using gsub or gsub!: > > > >>> 'b\\c'.gsub /\\/, '' > > => "bc" > > String#delete exists. Cool! Wasn't aware of that. Thx for the pointer! robert