APM: Currency Formatting

Tim Peoples tim at toolman.org
Mon Oct 10 08:06:49 PDT 2005


How about something like this?

   1 while $val =~ s/^(-?\$?\d+)(\d{3})/$1,$2/;

Tim.

David Bluestein II wrote:

>Okay, I've got currency (some $00000.00, some 0000.00, some 000.0) that 
>I need to run through a formatter and get out:
>
>$00,000.00
>
>I have the cents, and the $ sign, but is there an easy way to get 
>commas from sprint which is generating my decimal places? Or do I need 
>to use something more like the Format.pm? I looked in cookbook, and it 
>does commas based on straight numbers, not with decimals. Anyone have 
>an elegant solution, since the ones I googled were not.
>
>Thanks-
>
>David
>
>-----------------------------------------------------------------------
>David H. Bluestein II
>President & Lead Developer         dbii at interaction.net
>ii, inc.                                                  
>http://www.interaction.net
>     -- Specializing in Interactive, Database Driven Websites --
>
>_______________________________________________
>Austin mailing list
>Austin at pm.org
>http://mail.pm.org/mailman/listinfo/austin
>
>  
>

-- 
 _______________________________________________________________________  
                                                      Timothy E. Peoples
                                                   Have Camel, Will Code
                                                         tim at toolman.org




More information about the Austin mailing list