Parse a string with suffix unit [k|K|m|M|g|G|t|T]. Must be a whole integer, fractions not allowed (0.5t), no whitespace or +- Lowercase units are 1000 base. Uppercase units are 1024 base. Examples: 2m,27M,19g,41T
Declared in <util/strencodings.h>
std::optional<uint64_t>
ParseByteUnits(
std::string_view str,
ByteUnit default_multiplier);
optional uint64_t bytes from str or nullopt if ToIntegral is false, str is empty, trailing whitespace or overflow
| Name | Description |
|---|---|
| str [in] | the string to convert into bytes |
| default_multiplier [in] | if no unit is found in str use this unit |