[#BloombergLP-bdlb-NumericParseUtil-parseUnsignedInteger-0d4]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlb.adoc[bdlb]::xref:BloombergLP/bdlb/NumericParseUtil.adoc[NumericParseUtil]::parseUnsignedInteger
:relfileprefix: ../../../
:mrdocs:

Parse an unsigned integer not exceeding `maxValue` from a string&period;

== Synopsis

Declared in `&lt;bdlb&lowbar;numericparseutil&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
int
parseUnsignedInteger(
    xref:BloombergLP/bsls/Types/Uint64.adoc[bsls::Types::Uint64]* result,
    std::string&lowbar;view const& inputString,
    int base,
    xref:BloombergLP/bsls/Types/Uint64.adoc[bsls::Types::Uint64] const maxValue);
----

== Description

Parse the specified `inputString` for a sequence of characters representing digits in the specified `base`, consuming the maximum up to the optionally specified `maxNumDigits` that form a number whose value does not exceed the specified `maxValue`&period; Place into the specified `result` the extracted value&period; Optionally specify `remainder`, in which to store the remainder of the `inputString` immediately following the successfully parsed text, or the position at which a parse failure was detected&period; Return 0 on success, and a non&hyphen;zero value otherwise&period; The value of `result` is unchanged if a parse failure occurs&period; If `maxNumDigits` is not specified, it defaults to a number larger than the number of possible digits in an unsigned 64&hyphen;bit integer&period; The behavior is undefined unless `2 &lt; &equals; base` and `base &lt;&equals; 36` (i&period;e&period;, bases where digits are representable by characters `&lsqb; 0 &period;&period; 9 &rsqb;`, `&lsqb; a &period;&period; z &rsqb;` or `&lsqb; A &period;&period; Z &rsqb;`)&period;

A parse failure can occur for the following reasons&colon; 1&period; The `inputString` is not a `&lt;POSITIVE&lowbar;NUMBER&gt;`, i&period;e&period;, does not begin with a digit&period; 2&period; The first digit in `inputString` is larger than `maxValue`&period; 3&period; The first digit is not a valid number for the `base`&period;

== Return Value

0 on success, and a non&hyphen;zero value otherwise

== Parameters

[cols="1,4"]
|===
| Name| Description
| *result*
| location to store the parsed value
| *inputString*
| text to parse
| *base*
| numeric base in `&lsqb;2 &period;&period; 36&rsqb;`
| *maxValue*
| highest acceptable parsed value
|===


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