replaceFirstChar


replaceFirstChar - Kotlin Programming Language

println("kotlin".replaceFirstChar { it.uppercase() }) // Kotlin

val sentence = "Welcome to Kotlin!"
val words = sentence.split(' ');
println(words.joinToString(separator = "_") 
	{ word -> word.replaceFirstChar { it.lowercase() } }) // welcome_to_kotlin!

특정 문자 제거하기


Remove a Character From a String in Kotlin | Baeldung on Kotlin

replace

val string = "Ba.eldung"
assertEquals("Baeldung", string.replace(".", ""))

filter

val string = "Ba.eldung"
assertEquals("Baeldung", string.filterNot { it == '.' })

StringBuilder.deletateAt