[#absl-from_chars-0b] = xref:absl.adoc[absl]::from_chars :relfileprefix: ../ :mrdocs: Workalike compatibility version of std::from_chars from C++17. Currently this only supports the `double` and `float` types. == Synopsis Declared in `<absl/strings/charconv.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:absl/from_chars_result.adoc[absl::from_chars_result] from_chars( char const* first, char const* last, double& value, xref:absl/chars_format.adoc[chars_format] fmt = chars_format::general); ---- == Description This interface incorporates the proposed resolutions for library issues DR 3080 and DR 3081. If these are adopted with different wording, Abseil's behavior will change to match the standard. (The behavior most likely to change is for DR 3081, which says what `value` will be set to in the case of overflow and underflow. Code that wants to avoid possible breaking changes in this area should not depend on `value` when the returned from_chars_result indicates a range error.) Searches the range [first, last) for the longest matching pattern beginning] at `first` that represents a floating point number. If one is found, store the result in `value`. The matching pattern format is almost the same as that of strtod(), except that (1) C locale is not respected, (2) an initial '+' character in the input range will never be matched, and (3) leading whitespaces are not ignored. If `fmt` is set, it must be one of the enumerator values of the chars_format. (This is despite the fact that chars_format is a bitmask type.) If set to `scientific`, a matching number must contain an exponent. If set to `fixed`, then an exponent will never match. (For example, the string "1e5" will be parsed as "1".) If set to `hex`, then a hexadecimal float is parsed in the format that strtod() accepts, except that a "0x" prefix is NOT matched. (In particular, in `hex` mode, the input "0xff" results in the largest matching pattern "0".) == Return Value A from_chars_result describing where parsing stopped and any error. == Parameters [cols="1,4"] |=== | Name| Description | *first* | Pointer to the first character of the input range. | *last* | Pointer to one past the last character of the input range. | *value* | Set to the parsed number when a match is found. | *fmt* | The floating‐point format to accept. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#