ScriptPrimitives

Because the languages used in scripts usually have very broad requirements for numeric types. For example, all numbers in JS are Double, which can cause problems on interoperations.

The functions provided by this util can explicitly convert script numbers or strings into primitives of the JVM.

Functions

Link copied to clipboard
fun boolean(boolean: Boolean): Boolean
fun boolean(string: String?): Boolean
Link copied to clipboard
fun byte(byte: Byte): Byte
fun byte(long: Long): Byte
fun byte(string: String?, radix: Int = 10): Byte
Link copied to clipboard
fun char(char: Char): Char
fun char(long: Long): Char
fun char(string: String?): Char
Link copied to clipboard
fun double(double: Double): Double
fun double(string: String?): Double
Link copied to clipboard
fun float(double: Double): Float
fun float(float: Float): Float
fun float(string: String?): Float
Link copied to clipboard
fun int(int: Int): Int
fun int(long: Long): Int
fun int(string: String?, radix: Int = 10): Int
Link copied to clipboard
fun long(long: Long): Long
fun long(string: String?, radix: Int = 10): Long
Link copied to clipboard
fun short(long: Long): Short
fun short(short: Short): Short
fun short(string: String?, radix: Int = 10): Short