From: Sebastian Hungerecker Date: 2007-09-19T03:19:45+09:00 Subject: Re: converting text Analogy Analogy wrote: > I tried cutting and pasting this in SciTE to see if it works...it > didn't, but thanks for directing me in the right direction. How does it not work? Both versions work just fine in irb: >> ["1.80%", "14.50%", "ruby", "3.10%"].map do |string| >> string.gsub(/\d+(\.\d+)?/) {|match| "%.1f" % match} >> end => ["1.8%", "14.5%", "ruby", "3.1%"] >> ["1.80%", "14.50%", "ruby", "3.10%"].map do |string| >> string.gsub(/\d+(\.\d+)?/) {|match| match.to_f.to_s} >> end => ["1.8%", "14.5%", "ruby", "3.1%"] -- NP: Count Raven - The Lie of Life Jabber: sepp2k@jabber.org ICQ: 205544826