Like dynamic arrays (ArrayList), strings are also represented by a class and have a backup array of characters. Similar to other data structures, strings also can be implemented as mutable and immutable.
Immutable strings in Kotlin are represented by the String class, whereas mutable strings are represented by the StringBuilder class.
The string class doesn't provide any public API to mutate the backed-up character array. So you can only find APIs such as elementAt(), indexOf(), and lastIndexOf() or similar get functions. Though it has mutating APIs such as subSequence(), capitalize(), or similar, they always create a copy of the string and return the updated one without mutating the existing string.
In the other case, StringBuilder offers many mutating APIs such as append(), insert(), replace(), reverse(), and many more. These APIs literally...