int
Commons
stable
Thin wrapper around parseInt with a default radix of 10. Accepts both string and number inputs.
API
Signature
Full TypeScript signature sourced from the util file.
API
Parameters
Input parameters accepted by this util.
- valuerequiredstring | number
- The value to parse. Strings are parsed as integers; numbers are passed to parseInt directly.
- radixnumber10
- The base for the parseInt call. Defaults to 10 (decimal). Use 16 for hex strings.
API
Return value
The value returned by this util.
- The parsed integer. Returns NaN for non-numeric input (same as parseInt behaviour).
Usage
Examples
Ready-to-paste usage snippets.
Parse integers from strings