Strings are represented by the type String. Strings are immutable. Elements of a string are characters can be accessed by the indexing operation: s[i]. A string can be iterated over with a for loop:
Kotlin has two types of string literals: escaped strings that may have escaped characters in them and raw strings that can contain newlines and arbitrary text. An escaped string is very much like a Java string:
Escaping is done in the conventional way, with a backslash.
A raw string is delimited by a triple quote ("""), contains no escaping and can contain newlines and any other characters:
Strings may contain template expressions, i.e. pieces of code that are evaluated and whose results are concatenated into the string. A template expression starts with a dollar sign ($) and consists of either a simple name:
or an arbitrary expression in curly braces: