lineSequence

Splits this char sequence to a sequence of lines delimited by any of the following character sequences: CRLF, LF or CR.

fun CharSequence.lineSequence(): Sequence<String>(source)
val text = """
    First line
    Second line
    Third line
""".trimIndent()

text.lineSequence().forEachIndexed { index, line ->
    println("${index + 1}: $line")
}

Source