Strings In Depth10 / 17
Up next

Replace text

fun main() {
    val s = "a-b-c"
    println(s.replace("-", "_"))
    // replaceFirst changes only the first match
    println(s.replaceFirst("-", "_"))
}
What you're solving

replace all or just the first