[tpm] currency deformatter
indy at indigostar.com
Thu Feb 5 08:08:16 PST 2009
The code below will do what you want for your test cases. I'm not sure
that two lines of code justifies a whole module.
$x = '$24,969.00(txincl.)';
($c) = $x =~ /([0-9\.,]+)/;
$c =~ s/,//g;
print "$x -> $c\n";
IndigoSTAR Software -- www.indigostar.com
----- Original Message -----
From: "Ilia" <samogon at gmail.com>
To: <tpm at to.pm.org>
Sent: Thursday, February 05, 2009 10:29 AM
Subject: [tpm] currency deformatter
>I can't believe there doesn't seem to be a CPAN module to parse a
> currency into a decimal.
> The function I'm looking for should return a decimal based on various
> input like:
> any extraneous data like "(txincl.)" should be removed. any spaces
> should be removed.
> Any takers?
> toronto-pm mailing list
> toronto-pm at pm.org
More information about the toronto-pm