[tpm] currency deformatter

Quantum Mechanic quantum.mechanic.1964 at gmail.com
Thu Feb 5 08:55:42 PST 2009


[Reply to all]

$x = '$65,345.89zzzzzz';
if ($x =~ /\$([\d,.+-]+)/) { $y = $1 }

(Obviously you can be more sophisticated with the match.)

There's probably a FAQ for this, but I'm lazy today.

On Thu, Feb 5, 2009 at 10:29 AM, Ilia <samogon at gmail.com> wrote:

> 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:
> $65,345.89
> $65.345,89
> $24,969.00(txincl.)
> $24,969.00*
>
> any extraneous data like "(txincl.)" should be removed. any spaces
> should be removed.
>
> Any takers?
>
> ilia.
> _______________________________________________
> toronto-pm mailing list
> toronto-pm at pm.org
> http://mail.pm.org/mailman/listinfo/toronto-pm
>



-- 
-QM
Quantum Mechanics: The dreams stuff is made of
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/toronto-pm/attachments/20090205/c3e20397/attachment.html>


More information about the toronto-pm mailing list