[tpm] currency deformatter

Ilia samogon at gmail.com
Thu Feb 5 07:59:14 PST 2009


Here's a test to get started...

use strict;
use Test::More tests=>4;
my @got_data = (
'$65,345.89',
'$65.345,89',
'$65,345.89(txincl.)',
'$65,345.89*',
);
my $expected = '65345.89';

foreach my $got ( @got_data ) {
    is(fixup_currency($got), $expected, "fixup $got");
}


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.
>



-- 
Ilia Lobsanov
Nurey Networks - http://www.nurey.com
New Ideas for a New Economy
Python, Perl, Java, Linux & more
Toronto +1 647 996 9087
Boston +1 781 328 1162


More information about the toronto-pm mailing list