42 #define isdigit(ch) ('0'<=(char)(ch) && (char)(ch)<='9')
43 #define remove_isdigit
45 static mnyfmt_long TENPOW[6+1] = { 1,10,100,1000,10000,100000,1000000 };
46 if ( CE>(-1+
sizeof(TENPOW)/
sizeof(*TENPOW)) ) {
return 0; }
48 const char *p = amount;
50 while ( (*p!=0) && !
isdigit(*p) && *p!=dec ) { isNegative = (*p==
'-'); ++p; }
51 if ( *p==0 ) {
return 0; }
54 while ( *p!=0 && *p!=dec ) {
55 if (
isdigit(*p) ) { nInt = nInt*10 + (*p-
'0'); }
62 for ( i=0; i<CE; ++i ) {
64 if (
isdigit(*p) ) { nFrac += (*p-
'0'); ++p; }
68 nInt = nInt * TENPOW[CE] + nFrac;
69 if ( isNegative ) { nInt = -nInt; }
Header file for mnyfmt().
mnyfmt_long str2mnyCE(const char *amount, char dec, unsigned CE)
Returns an integer value that corresponds to 'amount', scaled 10^CE digits.