Timothy said:
thats exactly what i'm trying to do, only having to do that for all
my outputs is more work then i'd like :/
SUS has added numeric grouping
For some numeric conversions a radix character (`decimal
point') or thousands' grouping character is used. The
actual character used depends on the LC_NUMERIC part of
the locale. The POSIX locale uses `.' as radix character,
and does not have a grouping character. Thus,
printf("%'.2f", 1234567.89);
results in `1234567.89' in the POSIX locale, in
`1234567,89' in the nl_NL locale, and in `1.234.567,89' in
the da_DK locale.
but they hasn't added monetary grouping. I don't think you'll
get monetary grouping anytime soon. Besides as far as I understood
your question, you *always* want grouping, right?
Actually I don't think a cryptic flag is better than an explicit
formatter. What do you think is more clear for a maintainer of your
code?
print "%'.2f" % amount
or
print "%s" % dollars(amount)
why is this a misuse of locale? it's exactly what locale is meant for
isn't it?
I just reacted to your words "select a proper locale" and "how do i get
it to group thousands with a ,". It's just not a good idea to select
a locale and expect the grouping character to be "," or expect
grouping,
see nl_NL locale example above.
Serge.