mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-16 15:53:55 +00:00
These only apply when the receiver can be resolved to a constant and the margin prefix, if specified, is also a constant.
34 lines
651 B
Kotlin
Vendored
34 lines
651 B
Kotlin
Vendored
fun notConstant(arg: String): String {
|
|
return arg.trimMargin()
|
|
}
|
|
|
|
fun notConstantCustomPrefix(arg: String): String {
|
|
return arg.trimMargin("###")
|
|
}
|
|
|
|
fun interpolated(arg: Int):String {
|
|
return """
|
|
|Hello,
|
|
|$arg
|
|
""".trimMargin()
|
|
}
|
|
|
|
fun notInvoked():String {
|
|
return """
|
|
|Hello,
|
|
|World
|
|
"""
|
|
}
|
|
|
|
fun constantWithNonConstantCustomPrefix(arg: String): String {
|
|
return """
|
|
|Hello,
|
|
|World
|
|
""".trimMargin(arg)
|
|
}
|
|
|
|
// 1 LDC "\\n \|Hello,\\n \|"
|
|
// 1 LDC "\\n "
|
|
// 2 LDC "\\n \|Hello,\\n \|World\\n "
|
|
// 4 INVOKESTATIC kotlin/text/StringsKt.trimMargin
|