I'm trying to include some more info into a string...
# getting-started
k
I'm trying to include some more info into a string based on some flags. Is there a shorter way than below of doing this?
Copy code
"...${if (debug) "-debug" else ""}-..."
e
not shorter but definitely clearer:
Copy code
buildString {
    append("...")
    if (debug) append("-debug")
    append("-..."
}
thank you color 1
☝️ 1
in some cases
Copy code
listOfNotNull(
    "...",
    if (debug) "debug" else null,
    "...",
).joinToString(separator = "-")
might be more natural but at a glance I don't think this is one of them
k
Thank you, I love the
buildString
one 😛 This make me less miss the Java
... ? .. : ..
things 😄