Kotlin string to Int type error reporting

Kotlin integer string calling toInt() method reports an error NumberFormatException

Solution

First convert to Double, then convert to Int

("6").toDouble().toInt()

Guess you like

Origin blog.csdn.net/xiaopihair123/article/details/131810986