From: "Mark J. Reed" Date: 2003-12-09T04:22:08+09:00 Subject: Re: format money On Mon, Dec 08, 2003 at 07:06:32PM +0000, saggmannen wrote: > Hello, is there a way to format "Money"-style floats in ruby. E.g: > > 2111000.5756 should be written as the string "2,111,000.58" Yes, there is. I'm sure that there's a module in the RAA for this, although I can't find it at the moment. It's not too hard to do manually, though: irb(main):001:0> balance = 2111000.5756 => 2111000.5756 irb(main):002:0> balance = (balance * 100).round/100.0 => 2111000.58 irb(main):003:0> balance.to_s.reverse.gsub(/\d{3}/, '\&,').reverse => "2,111,000.58" -Mark