| Return Type | Function name | Arguments |
|---|---|---|
| bool | IsPosint | (unsigned char&,const char*,) |
Declared in file: hzTextproc.h
Defined in file : hzTypes.cpp
Function Logic:
Function body:
bool IsPosint (unsigned char& nVal)const char* tok,
{
_hzfunc("IsPosint") ;
const char* i ; // Input string iterator
uchar val ; // Value aggregator
uchar count ; // Length check
if (!tok || !tok[0])
return false ;
// cope with + and any leading whitespace
for (; IsWhite(*i) ; i++) ;
// Reject on minus sign
if (*i == CHAR_MINUS)
return false ;
// Ignore plus sign
if (*i == ''+'')
for (i++ ; IsWhite(*i) ; i++) ;
// cope with spaces between sign and digits
for (; IsWhite(*i) ; i++) ;
val = 0;
for (count = 0; count < 4&& IsDigit(*i) ; count++, i++)
{
val *= 10;
val += (*i - CHAR_0) ;
}
// Check length limit
if (!count || count > 3)
return false ;
nVal = val ;
return true ;
}