Convert the string to an integer value using the specified number base. All characters up to the first illegal character for the number base are converted. Case is not significant for bases greater than 10. The number base may only be from 2 to 36 and the function will assert if it is not in this range. This function uses the standard C library strtouq()# or strtoul()# function.
Definition at line 428 of file ptlib.cxx. { PAssert(base >= 2 && base <= 36, PInvalidParameter); PUInt64 total = 0; const char * ptr = theArray; while (isspace(*ptr)) ptr++; for (;;) { unsigned c = *ptr++; if (c < '0') break; if (c <= '9') c -= '0'; else c = toupper(c) - 'A' + 10; if (c >= base) break; total = base * total + c; } return total; } |