Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

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()
withoutIndent
ABC 123 456

Below 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()
sql
select * from some_table where id = 100 order by id

trimMargin

trimMargin is more flexible and useful than trimIndent.

val withoutMargin1 = """ABC
                |123
                |456""".trimMargin()
withoutMargin1
ABC 123 456
val withoutMargin2 = """
    #XYZ
    #foo
    #bar
""".trimMargin("#")
withoutMargin2
XYZ foo bar
val sql ="""
    |select
    |    *
    |from
    |    some_table
    |where
    |    id = 100
    |order by
    |    id
    """.trimMargin()
sql
select * from some_table where id = 100 order by id
"".isBlank()
true
"""
                  
""".isBlank()
true
"a".isBlank()
false

split

"a b c".split(" ")
[a, b, c]