Developer/Android

Kotlin 형변환

hungry7013 2021. 1. 22. 10:14

Kotlin

 

안녕하세요.

Kotlin 형변환에 대해서 말씀드리겠습니다.

 

String -> Int

.toInt()

 

Int -> String

.toString()

 

 

var abcdInt = 1010
val abcdString: String

abcdString = abcdInt.toString()
System.out.println("abcdString : $abcdString")

abcdInt = abcdString.toInt()
System.out.println("abcdInt : $abcdInt")