CS Electrical And Electronics
@cselectricalandelectronics

How to convert string into integer in Kotlin?

All QuestionsCategory: KotlinHow to convert string into integer in Kotlin?
chetan shidling asked 3 years ago

I need short information.

1 Answers
chetan shidling answered 3 years ago

Here is the code to convert string into Integer in Kotlin.
 
fun main(args : Array<String>){
var str : String = “4”
var num1 : Int = str.toInt()
num1++
println(“The Integer after increment is $num1”)
}
 
Output:
 
The Integer after increment is 5