[#ToIntegral]
= ToIntegral
:mrdocs:

Convert string to integral type T&period; Leading whitespace, a leading &plus;, or any trailing character fail the parsing&period; The required format expressed as regex is `&hyphen;?&lsqb;0&hyphen;9&rsqb;&plus;` by default (or `&hyphen;?&lsqb;0&hyphen;9a&hyphen;fA&hyphen;F&rsqb;&plus;` if base &equals; 16)&period; The minus sign is only permitted for signed integer types&period;

== Synopsis

Declared in `&lt;util&sol;strencodings&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;typename T&gt;
std::optional&lt;T&gt;
ToIntegral(
    std::string&lowbar;view str,
    size&lowbar;t base = 10);
----

== Return Value

std&colon;&colon;nullopt if the entire string could not be parsed, or if the parsed value is not in the range representable by the type T&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *str*
| The string to parse&period;
| *base*
| The numeric base to parse in (default 10)&period;
|===


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