toIntOrNull
Parses the string to an Int number or returns null
if the string is not a valid representation of an Int.
The string must consist of an optional leading +
or -
sign and decimal digits (0-9
), and fit the valid Int value range (within Int.MIN_VALUE..Int.MAX_VALUE
), otherwise null
is returned.
Since Kotlin
1.1Samples
Parses the string as an Int number and returns the result or null
if the string is not a valid representation of a number.
Since Kotlin
1.1Throws
when radix is not a valid radix for string to number conversion.