The problem is that you tried to do a direct from String to Int using value as Int
.
, , , value
, Int. , String , , Int. toInt()
.
, , , toInt()
String, value
Any?
. , toInt()
value
, , , , . , , :
if (value is String) {
value.toInt()
}
Kotlin: https://kotlinlang.org/docs/reference/typecasts.html#smart-casts
. , Int, , , , , String, . , , Int String? , , , , Any?
. / , .