String Basics: Literals, Escape Sequences & Length
Create strings, use escape characters, and measure string length.
Strings Are Objects
In Kotlin, String is an immutable class with dozens of useful methods. Every string literal creates a String object.
String Literals
Strings are enclosed in double quotes. Single quotes are reserved for Char.
val greeting = "Hello, Kotlin!"
val empty = ""
val withSpaces = " trimmed "All lessons in this course
- String Basics: Literals, Escape Sequences & Length
- String Templates: $variable and ${expression}
- Raw Strings and Triple Quotes
- Key String Functions: trim, split, replace, contains