[#BloombergLP-bdljsn-NumberUtil-asShort]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdljsn.adoc[bdljsn]::xref:BloombergLP/bdljsn/NumberUtil.adoc[NumberUtil]::asShort
:relfileprefix: ../../../
:mrdocs:

Load the specified `result` with the specified `value`&period;

== Synopsis

Declared in `&lt;bdljsn&lowbar;numberutil&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
int
asShort(
    short* result,
    std::string&lowbar;view const& value);
----

== Description

Load `result` even if a non&hyphen;zero status is returned (truncating fractional digits if necessary)&period; Return 0 on success, `k&lowbar;OVERFLOW` if `value` is larger than can be represented by `result`, `k&lowbar;UNDERFLOW` if `value` is smaller than can be represented by `result`, and `k&lowbar;NOT&lowbar;INTEGRAL` if `value` is not an integral number (i&period;e&period;, there is a fractional part)&period; For underflow, `result` will be loaded with the minimum representable value, for overflow, `result` will be loaded with the maximum representable value, for non&hyphen;integral values `result` will be loaded with the integer part of `value` (truncating the fractional part of `value`)&period; The behavior is undefined unless `isValidNumber(value)` is `true`&period; Note that this operation will correctly handle exponents (e&period;g&period;, a `value` of &quot;0&period;00000000000000000001e20&quot; will produce a `result` of 1)&period;

== Return Value

0 on success, or a non&hyphen;zero status (`k&lowbar;OVERFLOW`, `k&lowbar;UNDERFLOW`, or `k&lowbar;NOT&lowbar;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]#
