Function

GLib-2.0GLibstrtod

  • Converts a string to a floating point 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 GLib.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 GLib.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.

    Parameters

    • nptr: string

      the string to convert to a numeric value

    Returns [number, string]

    the converted value