From: Hd Pwnz0r Date: 2010-08-10T22:51:46+09:00 Subject: Re: Hel;p with Tip Calculator Hassan Schroeder wrote: > On Sun, Aug 8, 2010 at 8:59 AM, Andrei Beliankou > wrote: > >> Use >> >> '45 %'.sub(/%/, '').strip >> '14 $'.sub(/[$]/, '').strip > > More universally > > input_string.gsub(/\D/, '') > > removes any non-[0-9] characters, including white space. I get: tax.rb:6:in `
': undefined method `gsub' for 0:Fixnum (NoMethodError) When using that code. As for Andrei, thanks, that's a good quick fix. -- Posted via http://www.ruby-forum.com/.