develooper Front page | perl.beginners | Postings from October 2009

Re: printf with currency symbols

Thread Previous | Thread Next
From:
Shawn H Corey
Date:
October 26, 2009 11:33
Subject:
Re: printf with currency symbols
Message ID:
4AE5EB9E.9050906@gmail.com
Robert Citek wrote:
> Not sure if there is a better way.  My guess is that there is probably
> some module to convert float to currency and then print it as a
> string.  But a quick Google didn't turn up anything.

Here' why (extracted from `perldoc perllocale`):

   Category LC_MONETARY: Formatting of monetary amounts

       The C standard defines the "LC_MONETARY" category, but no
function that is affected by its contents.  (Those with experience of
standards committees will recognize that the working group decided to
punt on the issue.)  Consequently, Perl takes no notice of it.  If you
really want to use "LC_MONETARY", you can query its contents--see "The
localeconv function"--and use the information that it returns in your
application’s own formatting of currency amounts.  However, you may well
find that the information, voluminous and complex though it may be,
still does not quite meet your requirements: currency formatting is a
hard nut to crack.



-- 
Just my 0.00000002 million dollars worth,
  Shawn

Programming is as much about organization and communication
as it is about coding.

I like Perl; it's the only language where you can bless your
thingy.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About