Elements of String
suggest changeElements of String are characters that can be accessed by the indexing operation string[index]
.
val str = "Hello, World!"
println(str[1]) // Prints e
String elements can be iterated with a for-loop.
for (c in str) {
println(c)
}
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents