Kotlin Programming Cookbook
上QQ阅读APP看书,第一时间看更新

How to do it...

To parse the string to a Long data type, we use the .toLong() method with the string. It parses the string as a Long number and returns the result. It throws NumberFormatException if the string is not a valid representation of a number. Later, we will see examples for this.