In multiline string, is there a way to add newline...
# announcements
n
In multiline string, is there a way to add newline in literal but not in string itself? I realize it’s possible to do
Copy code
""" …\n """.replace("\n", "")
but i’m looking for a better way
s
If you are using it a lot create an extension function out of it.
n
so there’s no way other than replacing
Copy code
\n
r
What else would you want it to do?
b
Could you provide some more examples of what you mean?
n
what i mean to ask is, do we have something similar to trimMargin which omit margin chars.
i’m already using an extension method. was only wondering if i’m missing something that’s already available in stdlib
b
If I am understanding correctly there’s the option to
x.trimMargin("\\n")