如何在Kotlin中使用.replace()
将字符串的许多部分替换为其他部分
例如,我们只能通过替换一个单词来做到这一点
fun main(args: Array<String>) {
var w_text = "welcome his name is John"
println("${w_text.replace("his","here")}")
}
结果将是"欢迎光临,我叫约翰".
finally we need the result be " welcome here name is alles "
by replacing his to here and john to alles using .replace()