From: "Florian Aßmann" Date: 2007-05-31T16:13:00+09:00 Subject: Re: remove all whitespaces in a string Hi, since Strings are Enumerable I created a singleton method that overwrites the default one: def str.each &block self.split( // ).each &block end str.reject { |char| char =~ /\s/ } But I don't know if this is going to brake anything... Sincerely Florian Am 28.05.2007 um 15:51 schrieb Harry Kakueki: > On 5/28/07, jochen kaechelin wrote: >> I want to remove all whitespaces in a string. >> I know strip to remove whitespaces at the beginning and the end >> of the string. >> >> example: >> >> " bla @ bla. de " >> >> should become >> >> "bla@bla.de" >> >> How can I achieve this? >> >> Thanx >> >> > > This is probably slower, but here is another way you can try. > > p " bla @ bla. de ".split(/\s+/).join > > Harry > > -- > > A Look into Japanese Ruby List in English > http://www.kakueki.com/ >