Programming/Kotlin

[Kotlin] 대문자, 소문자 변환 .toUpperCase(), .toLowerCase()

Developer 수한 2021. 4. 19. 13:01

코틀린 .toUpper() / .toLowerCase()

fun main() {

	// "abcde"가 들어간 문자열 word 생성
    var word = "abcde"

    println(word) // 결과 : abcde

	// 대문자로 변환
    word = word.toUpperCase()

    println(word) // 결과 : ABCDE

	// 소문자로 변환
    word = word.toLowerCase()

    println(word) // 결과 : abcde
    
}