contents   index   previous   next



Clib.strtod()

syntax:

Clib.strtod(str[, endStr])

where:

str - string to be converted to a number.

 

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

 

return:

number - the first part of str converted to a double precision number.

 

description:

This method converts the string str into a number and optionally returns a partial string that begins beyond the characters parsed by this method. White space characters are skipped at the start of str, and the string characters are converted to a float as long as they match the following format.

 

[sign][digits][.][digits][format[sign]digits]

 

The parameter endStr is not compared against null, as it is in standard C implementations, and is optional. 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.strtok()

 

example:

// The following strings, are examples

// that can be converted.

//  "1"

//  "1.8"

//  "-400.456e-20"

//  ".67e50"

//  "2.5E+50"

 


Clib.strtok()