0Pricing
Kotlin Academy · Lesson

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

  1. String Basics: Literals, Escape Sequences & Length
  2. String Templates: $variable and ${expression}
  3. Raw Strings and Triple Quotes
  4. Key String Functions: trim, split, replace, contains
← Back to Kotlin Academy