parseNumericLiteral¶
fun parseNumericLiteral(text: String, isFloatingPointLiteral: Boolean): Number?
Parses the text representation of a number literal into a Number instance.
For integer literals, always returns a Long instance. For floating-point literals, returns either a Float or a Double, depending on the literal precision. Returns null if the text is not a valid representation of a number literal.
Parameters¶
- isFloatingPointLiteral: Specifies whether the number is floating-point (
FloatorDouble) or integer (Byte,Short,IntorLong).