[#ParseByteUnits]
= ParseByteUnits
:mrdocs:

Parse a string with suffix unit &lsqb;k&verbar;K&verbar;m&verbar;M&verbar;g&verbar;G&verbar;t&verbar;T&rsqb;&period; Must be a whole integer, fractions not allowed (0&period;5t), no whitespace or &plus;&hyphen; Lowercase units are 1000 base&period; Uppercase units are 1024 base&period; Examples&colon; 2m,27M,19g,41T

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
std::optional&lt;uint64&lowbar;t&gt;
ParseByteUnits(
    std::string&lowbar;view str,
    xref:ByteUnit.adoc[ByteUnit] default&lowbar;multiplier);
----

== Return Value

optional uint64&lowbar;t bytes from str or nullopt if ToIntegral is false, str is empty, trailing whitespace or overflow

== Parameters

[cols="1,4"]
|===
| Name| Description
| *str* [in]
| the string to convert into bytes
| *default&lowbar;multiplier* [in]
| if no unit is found in str use this unit
|===


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