const val question = "life, the universe, and everything"
const val answer = 42
val tripleQuotedString = """
#question = "$question"
#answer = $answer""".trimMargin("#")
fun main() {
println(tripleQuotedString)
}
结果:
question = "life, the universe, and everything"
answer = 42
val tripleQuotedString = """
#question = "$question"
#answer = $answer""".trimMargin("#")
结果:
question = "life, the universe, and everything"
answer = 42
val tripleQuotedString = """
#question = "$question"
#answer = $answer""".trimIndent()
结果:
#question = "life, the universe, and everything"
#answer = 42
val tripleQuotedString = """
#question = "$question"
#answer = $answer""".trimIndent()
结果:
#question = "life, the universe, and everything"
#answer = 42