is_numeric

 

Description

Test given string to determine whether it is a numeric string

Syntax

BOOL is_numeric( LPCSTR lpcstr, BOOL bThousoudSeparatorOK = TRUE, BOOL bLeadZeroOK = TRUE, BOOL bIgnoreRegionalNumeric = false )

Parameters

lpcstr
[input] the alpha numeric string to test
bThousoudSeparatorOK
[input] to decide if thousand's separator can be used, like 1,234,567
bLeadZeroOK
[input] to decide if 01060 is a number (TRUE) or it should be considered not a number (bLeadZeroOK=FALSE)
bIgnoreRegionalNumeric
[input] true if caller know that lpcstr is in USA numeric string like 123,346,789.1234

Return

TRUE if given string is numeric, otherwise FALSE.

Examples

EX1

double    is_numeric_ex1(string str = "0.12545")
{            
    if (is_numeric(str))
        return atof(str);
    else
        return NANUM;
}

Remark

See Also

header to Include

origin.h

Reference