0

Converting editable to double in Kotlin

I have edit text in my layout. I want to get double and make some calculations on it. Due to it's editable I cannot make calculations and couldn't convert it to double. Any easy way to convert it?

5th Jan 2022, 1:18 AM
Artem G.
Artem G. - avatar
4 Answers
+ 3
Artem G. There would be !!.toDouble() Try this: fun main(args: Array<String>) { var a = readLine()!!.toDouble() var b = readLine()!!.toDouble() println(a+b) }
5th Jan 2022, 2:26 AM
A͢J
A͢J - avatar
0
Why "!!.toDouble" doesn't work?
5th Jan 2022, 2:17 AM
Artem G.
Artem G. - avatar
0
Ä°t's not readln. Ä°t,'s gettext.
5th Jan 2022, 2:33 AM
Artem G.
Artem G. - avatar