The following code doesn't work in Kotlin:
var s: String = "hello"
s[1]='a'
Does Kotlin have a mutable string type or do I have to use an Array<Char> if I want to be able to edit?
The following code doesn't work in Kotlin:
var s: String = "hello"
s[1]='a'
Does Kotlin have a mutable string type or do I have to use an Array<Char> if I want to be able to edit?
No, it doesn't.
You can use a StringBuilder to manipulate it:
val sb = StringBuilder("hello")
sb[1] = 'a'
println(sb.toString())
hallo