[#BloombergLP-bdljsn-NumberUtil-asInteger] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdljsn.adoc[bdljsn]::xref:BloombergLP/bdljsn/NumberUtil.adoc[NumberUtil]::asInteger :relfileprefix: ../../../ :mrdocs: Load into the specified `result` the integer conversion of `value`. == Synopsis Declared in `<bdljsn_numberutil.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class t_INTEGER_TYPE> static int asInteger( t_INTEGER_TYPE* result, std::string_view const& value); ---- == Description Load into `result` (of the template parameter type `t_INTEGER_TYPE`) the specified `value`, even if a non‐zero status is returned (truncating fractional digits if necessary). Return 0 on success, `k_OVERFLOW` if `value` is larger than can be represented by `result`, `k_UNDERFLOW` if `value` is smaller than can be represented by `result`, and `k_NOT_INTEGRAL` if `value` is not an integral number (i.e., there is a fractional part). For underflow, `result` will be loaded with the minimum representable value, for overflow, `result` will be loaded with the maximum representable value, for non‐integral values `result` will be loaded with the integer part of `value` (truncating the value to the nearest integer). If the result is not an integer and also either overflows or underflows, it is treated as an overflow or underflow (respectively). The (template parameter) `t_INTEGER_TYPE` shall be either a signed or unsigned integer type (that is not `bool`) where `sizeof(t_INTEGER_TYPE) <= 8`. The behavior is undefined unless `isValidNumber(value)` is `true`. Note that this operation will correctly handle exponents (e.g., a `value` of "0.00000000000000000001e20" will produce a `result` of 1). == Return Value 0 on success, or a non‐zero status (`k_OVERFLOW`, `k_UNDERFLOW`, or `k_NOT_INTEGRAL`) otherwise == Parameters [cols="1,4"] |=== | Name| Description | *result* | receives the converted integer value | *value* | JSON number text to convert |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#