Answers for "kotlin multiline string"

2

kotlin multiline string

fun indentedStringLiteral() =
    """
        First Line
        Second Line
        Third Line
    """

fun unindentedStringLiteral() =
    """
        First Line
        Second Line
        Third Line
    """.trimIndent()


fun main(args: Array<String>) {
    println(indentedStringLiteral())
    //         First line
    //        Second Line
    println(unindentedStringLiteral())
    //First line
    //Second Line
    //Third line
}
Posted by: Guest on August-17-2021

Browse Popular Code Answers by Language