fun main() { val s = "a-b-c" println(s.replace("-", "_")) // replaceFirst changes only the first match println(s.replaceFirst("-", "_")) }
replace all or just the first