bj0
11/08/2017, 5:47 PMNumberFormatException
than your string probably isn't able to be represented as a Long
Kevin Janvier Chinabalire
11/08/2017, 5:52 PMval numb = "1000.0"
val amount : Int = numb.toInt()
println("amonnn $" +amount.toString())
NumberFormatException.forInputString
bj0
11/08/2017, 5:55 PM.toFloat()
or .toDouble()
msink
11/08/2017, 6:10 PMfun String.takeInt() : Int {
val str = takeWhile { it.isDigit() }
return if (str.isEmpty()) 0 else str.toInt()
}
bj0
11/08/2017, 6:51 PM.toDouble().toInt()
msink
11/08/2017, 7:23 PMbj0
11/08/2017, 8:12 PMKevin Janvier Chinabalire
11/08/2017, 8:22 PMtoDouble().toInt()