From: "David A. Black" Date: 2007-03-18T11:00:29+09:00 Subject: Re: Need help converting Perl to Ruby (detecting integers and decimals in strings) Hi -- On 3/15/07, Michael Fellinger wrote: > On 3/16/07, Paul wrote: > > That is brilliant! Thank you, Jon! Of all the good suggestions > > posted, I like this one best. You guys all rock! Thanks so much for > > the responses. > > > > Cheers! Paul. =) > > > > > > On Mar 15, 6:22 pm, Jon Garvin wrote: > > > rawfields.map { |f| f.to_f.to_s == f ? "%0.2f" % f.to_f : f } > > rawfields.map{|f| Integer(f) rescue Float(f) rescue f} That doesn't produce the desired output. David -- Q. What is THE Ruby book for Rails developers? A. RUBY FOR RAILS by David A. Black (http://www.manning.com/black) (See what readers are saying! http://www.rubypal.com/r4rrevs.pdf) Q. Where can I get Ruby/Rails on-site training, consulting, coaching? A. Ruby Power and Light, LLC (http://www.rubypal.com)