Skip to content

Commit

Permalink
allow and ignore spaces before the decimal seperator
Browse files Browse the repository at this point in the history
  • Loading branch information
stuart12 committed Apr 30, 2013
1 parent 726d904 commit a11eec5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/abank.cc
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,13 @@ AmountValidator::parse_amount(char const * s, int * v)
if (v == 0)
v = &dummy;
*v = 0;
while (isdigit(*s))
for (; isdigit(*s) || isspace(*s); s++)
{
*v = *v * 10 + *s++ - '0';
state = Acceptable;
if (isdigit(*s))
{
*v = *v * 10 + *s - '0';
state = Acceptable;
}
}
*v *= 100;
if (*s == '.' || *s == ',')
Expand Down

0 comments on commit a11eec5

Please sign in to comment.