0Pricing
Kotlin Academy · Lesson

Raw Strings and Triple Quotes

Use triple-quoted strings for multiline text and raw content without escapes.

What Is a Raw String?

A raw string uses triple quotes """...""" and preserves text exactly as written — no escape sequences, no special characters.

Basic Raw String

Triple-quoted strings can span multiple lines without explicit \n.

fun main() {
    val text = """
        Line 1
        Line 2
        Line 3
    """
    println(text)
}

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