absl::SimpleAtob

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

Synopsis

Declared in <absl/strings/numbers.h>

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

Description

The following case-insensitive strings are interpreted as boolean true: "true", "t", "yes", "y", "1". The following case-insensitive strings are interpreted as boolean false: "false", "f", "no", "n", "0". 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.