Str.strtod

Converts a string to a #gdouble value. It calls the standard strtod() function to handle the conversion, but if the string is not completely converted it attempts the conversion again with g_ascii_strtod(), and returns the best match.

This function should seldom be used. The normal situation when reading numbers not for human consumption is to use g_ascii_strtod(). Only when you know that you must expect both locale formatted and C formatted numbers should you use this. Make sure that you don't pass strings such as comma separated lists of values, since the commas may be interpreted as a decimal point in some locales, causing unexpected results.

struct Str
static
double
strtod
(
string nptr
,
out string endptr
)

Parameters

nptr string

the string to convert to a numeric value.

endptr string

if non-%NULL, it returns the character after the last character used in the conversion.

Return Value

Type: double

the #gdouble value.

Meta