thousandth separator

B

bmgz

I am in need of a *simple* thousandth separtor function or something ie.

1000000.00 => 1,000,000.00

is their any simple solution to this?
 
G

Gene Tani

bmgz said:
I am in need of a *simple* thousandth separtor function or something ie.

1000000.00 => 1,000,000.00

is their any simple solution to this?

you can input numbers with "_" as sort of a thousands separator, so

400_000 == 400000

for output, something like this:
http://rubyforge.org/snippet/detail.php?type=snippet&id=8

If you need anything locale-specific (e.g. switch between "," and "."
depenging on where you are, I'm not aware of anything like python
locale.format or locale.str. Googling shows lots of hits on *local*
vars or whatever. Let us know if you find anything
 
G

Gene Tani

Gene said:
you can input numbers with "_" as sort of a thousands separator, so

400_000 == 400000

for output, something like this:
http://rubyforge.org/snippet/detail.php?type=snippet&id=8

If you need anything locale-specific (e.g. switch between "," and "."
depenging on where you are, I'm not aware of anything like python
locale.format or locale.str. Googling shows lots of hits on *local*
vars or whatever. Let us know if you find anything

locale-specific formatting: Numeric#format_s in extensions gives
fine-grained control over currency, thousands separators, negatives,
decimal point, etc

http://extensions.rubyforge.org/rdoc/index.html

(i knew it was here somehwere, just took a couple days)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top