Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!
val withoutIndent ="""
ABC
123
456
""".trimIndent()
withoutIndentABC
123
456Below sounds like a bug somewhere as it is not what trimIdent supposed to do.
val sql ="""
select
*
from
some_table
where
id = 100
order by
id
""".trimIndent()
sqlselect
*
from
some_table
where
id = 100
order by
idtrimMargin¶
trimMargin is more flexible and useful than trimIndent.
val withoutMargin1 = """ABC
|123
|456""".trimMargin()
withoutMargin1ABC
123
456val withoutMargin2 = """
#XYZ
#foo
#bar
""".trimMargin("#")
withoutMargin2XYZ
foo
barval sql ="""
|select
| *
|from
| some_table
|where
| id = 100
|order by
| id
""".trimMargin()
sqlselect
*
from
some_table
where
id = 100
order by
id"".isBlank()true"""
""".isBlank()true"a".isBlank()falsesplit¶
"a b c".split(" ")[a, b, c]