contents   index   previous   next



Clib.strtol()

syntax:

Clib.strtol(str[, endStr[, radix]])

where:

str - string to be converted to a number.

 

endStr - the part of str after the characters that were actually parsed.

 

radix - the number base for the conversion.

 

return:

number - the first part of str converted to a long integer number.

 

description:

This method converts the string str into a number and optionally returns a string starting beyond the characters parsed in the method. White space characters are skipped at the start of str, and the string characters are converted to an integer as long as they match the following format.

 

[sign][0][x][digits]

 

The parameter endStr is not compared against null, as it is in standard C implementations and is optional. The parameter radix specifies the base for conversion. For example, base 10 would use decimal digits zero through nine, 0 - 9, and base 16 would use hexadecimal digits zero through nine, 0 - 9, uppercase letters "A" through "F", A - F, or lowercase letters "a" through "f", a - f. If radix is zero or is not supplied, then the radix is automatically determined based on the first characters of str.

 

If the parameter endStr is supplied, then endStr is set to a string beginning at the first character that was not used in converting. The return is the first part of str, converted to a floating-point number.

 

see:

Clib.strtod()

 

example:

// As examples, the following strings//

/ can be converted.

//  "1"

//  "12"

//  "-400"

//  "0xFACE"

 


Clib.strupr()