
上QQ阅读APP看书,第一时间看更新
Parsing String to Long, Double, or Int
Kotlin makes it really easy to parse String into other data types, such as Long, Integer, or Double.
In JAVA, Long.parseLong(), or the Long.valueOf() static method is used, which parses the string argument as a signed decimal long and returns a long value, and similarly for other data types such as Int, Double, and Boolean. Let’s see how to achieve it in Kotlin.