I need to format float like price for two decimal places and thousands spaces, like this: "1 082 233.00"
+4
A:
Use number_to_currency
or number_with_precision
:
number_with_precision(1082233, :precision => 2,
:separator => '.',
:delimiter => ' ')
# => '1 082 233.00'
See the NumberHelper documentation for details.
Pär Wieslander
2010-09-14 14:36:31
Thanks! It's ok!
alexandr
2010-09-14 15:42:59
A:
If you're not using Rails, take a look at: http://codesnippets.joyent.com/posts/show/1812
ropperman
2010-09-14 14:41:26