From: Robert Klemme Date: 2009-08-27T17:18:34+09:00 Subject: Re: spaces in strings 2009/8/26 Glenn Jackman : > At 2009-08-26 12:37PM, "Joonas Lindholm" wrote: >>  I have a string like '1 334.64' and  I need to remove the space so that >>  it becomes '1334.64'. I have I think ruby 1.6 in home computer where >>  worked gsub!(/\s/, '') but in other computer I have ruby 1.7 and it >>  doesn't seem to work. > > An option nobody has suggested so far:  String#delete > >    "1 334.64".delete(" ")  # ==> "1334.64" Another option that I haven't seen suggested: str.gsub!(/\s+/, '') Could be a bit faster than /\s/ if there are longer sequences of spaces. Cheers robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/