January 2018
Intermediate to advanced
434 pages
14h 1m
English
In this example, we will see how we can parse a string using the .toLongOrNull() method:
fun main(args: Array<String>) { val str="123.4" val str2="123" println(str.toLongOrNull()) println(str2.toLongOrNull())}
On running the preceding program, the following output is generated:
null 123
Read now
Unlock full access