Simon Lin
10/20/2020, 7:21 AMfun main() {
val stringDouble = "420.0"
val int = stringDouble.toIntOrNull()
assert(int != null) // failed
}
Big Chungus
10/20/2020, 7:26 AMjbnizet
10/20/2020, 7:26 AMnanodeath
10/20/2020, 4:20 PMSimon Lin
10/23/2020, 8:09 AMit’s not an int
stringDouble.toDouble()
is also not an int. But it can call toInt()
They got same prefix (toInt*) but do different work.nanodeath
10/23/2020, 3:16 PM