absl::SimpleAtod

Converts the given string into a double, returning true if successful.

Synopsis

Declared in <absl/strings/numbers.h>

[[nodiscard]]
bool
SimpleAtod(
    std::string_view str,
    double* out);

Description

The string (optionally followed or preceded by ASCII whitespace) may be rounded on overflow or underflow. See https://en.cppreference.com/w/c/string/byte/strtof for details about the allowed formats for str, except SimpleAtod is locale-independent and will always use the "C" locale. If any errors are encountered, this function returns false, leaving out in an unspecified state.

Return Value

true on success; otherwise false.

NOTE

The return value should not be discarded.

Parameters

NameDescription
strThe string to parse.
outThe location that receives the parsed value.