[#absl-from_chars-0b]
= xref:absl.adoc[absl]::from&lowbar;chars
:relfileprefix: ../
:mrdocs:

Workalike compatibility version of std&colon;&colon;from&lowbar;chars from C&plus;&plus;17&period; Currently this only supports the `double` and `float` types&period;

== Synopsis

Declared in `&lt;absl&sol;strings&sol;charconv&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:absl/from_chars_result.adoc[absl::from&lowbar;chars&lowbar;result]
from&lowbar;chars(
    char const* first,
    char const* last,
    double& value,
    xref:absl/chars_format.adoc[chars&lowbar;format] fmt = chars&lowbar;format&colon;&colon;general);
----

== Description

This interface incorporates the proposed resolutions for library issues DR 3080 and DR 3081&period; If these are adopted with different wording, Abseil&apos;s behavior will change to match the standard&period; (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&period; Code that wants to avoid possible breaking changes in this area should not depend on `value` when the returned from&lowbar;chars&lowbar;result indicates a range error&period;)

Searches the range &lsqb;first, last) for the longest matching pattern beginning&rsqb; at `first` that represents a floating point number&period; If one is found, store the result in `value`&period;

The matching pattern format is almost the same as that of strtod(), except that (1) C locale is not respected, (2) an initial &apos;&plus;&apos; character in the input range will never be matched, and (3) leading whitespaces are not ignored&period;

If `fmt` is set, it must be one of the enumerator values of the chars&lowbar;format&period; (This is despite the fact that chars&lowbar;format is a bitmask type&period;) If set to `scientific`, a matching number must contain an exponent&period; If set to `fixed`, then an exponent will never match&period; (For example, the string &quot;1e5&quot; will be parsed as &quot;1&quot;&period;) If set to `hex`, then a hexadecimal float is parsed in the format that strtod() accepts, except that a &quot;0x&quot; prefix is NOT matched&period; (In particular, in `hex` mode, the input &quot;0xff&quot; results in the largest matching pattern &quot;0&quot;&period;)

== Return Value

A from&lowbar;chars&lowbar;result describing where parsing stopped and any error&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *first*
| Pointer to the first character of the input range&period;
| *last*
| Pointer to one past the last character of the input range&period;
| *value*
| Set to the parsed number when a match is found&period;
| *fmt*
| The floating&hyphen;point format to accept&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
