From: Analogy Analogy Date: 2007-09-19T06:17:46+09:00 Subject: Re: converting text Szymon tichy wrote: > Hi group (my first post here). > > Imo it is only moderately close to perfection ;) > > ["10.001%", "r00t", "hax0r", "#x80C and #x670"].map do |string| > string.gsub(/\d+(\.\d+)?/) {|match| "%.1f" % match} > end > > ==> ["10.0%", "r0.0t", "hax0.0r", "#x80.0C and #x670.0"] Also, ["391", "2", "0.10%] becomes ["391.0", "2.0", "0.1%] Don't want to do change/anything to the first and second items. Is there a good place online, to learn about this type of stuff? Thanks. -- Posted via http://www.ruby-forum.com/.