Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

thousandth separator

58 views
Skip to first unread message

bmgz

unread,
Jan 15, 2006, 3:55:39 PM1/15/06
to
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?

Gene Tani

unread,
Jan 15, 2006, 5:23:24 PM1/15/06
to

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

Gene Tani

unread,
Jan 18, 2006, 11:37:16 AM1/18/06
to

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)

0 new messages