Common leading whitespace in Kotlin multiline (raw) strings is not automatically removed.
If the programmer wants them removed, they should either call .trimIndent() or prefix every line of their string with a common prefix (the default is |) and call .trimMargin().
Example using .trimIndent():
val string = """
Hello
World
""".trimIndent()
Examples using .trimMargin():
val string1 = """
|Hello
|World
""".trimMargin()
val string2 = """
> Hello
> World
""".trimMargin("> ")
Common leading whitespace in Kotlin multiline (raw) strings is not automatically removed. If the programmer wants them removed, they should either call
.trimIndent()
or prefix every line of their string with a common prefix (the default is|
) and call.trimMargin()
.Example using
.trimIndent()
:Examples using
.trimMargin()
: