Conversion to currency format

Hi,
Is there any handy (or standard) method to convert a Ruby string
“350000” or number 350000 to a US currency format such as: $350,000.00
or just $350,000 (without cents)? Thanks in advance.

Jinho L. wrote:

Hi,
Is there any handy (or standard) method to convert a Ruby string
“350000” or number 350000 to a US currency format such as: $350,000.00
or just $350,000 (without cents)? Thanks in advance.

http://currency.rubyforge.org/

Look at Currency::Parser, this seems like what you want.


Phillip “CynicalRyan” Gawlowski
http://cynicalryan.110mb.com/

Rule of Open-Source Programming #20:

Open Code != Good Code

Phillip G. wrote:

Look at Currency::Parser, this seems like what you want.

d’oh, Currency::Formatter is probably what you want, and not
Currency::Parser.


Phillip “CynicalRyan” Gawlowski
http://cynicalryan.110mb.com/

Rule of Open-Source Programming #4:

If you don’t work on your project, chances are that no one will.

On Apr 5, 1:01 pm, Jinho L. [email protected] wrote:

Is there any handy (or standard) method to convert a Ruby string
“350000” or number 350000 to a US currency format such as: $350,000.00
or just $350,000 (without cents)? Thanks in advance.

This is included in the ActionView library, that is also part of
Rails:
http://api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html#M000520