https://kotlinlang.org logo
Title
u

Uzi Landsmann

01/18/2019, 12:22 PM
I have a multiline yaml string that I’d like to use in a program. The problem is that it contains dollar signs and quotes, which if I understand correctly cannot be escaped in a multiline string. Is my only option to concatenate many single line strings? Or is there another way?
k

karelpeeters

01/18/2019, 12:23 PM
You mean something like this? https://pl.kotl.in/SyzLHBJXV
You don't even need to escape them.
u

Uzi Landsmann

01/18/2019, 12:27 PM
Unfortunately they look like like this: “”" “${somthing}” “”"
a

Alowaniak

01/18/2019, 12:27 PM
If there's valid identifier characters right after the dollar sign it'll say it's an unresolved reference though, in that case you could do
${'$'}foo
u

Uzi Landsmann

01/18/2019, 12:28 PM
No it’s not 😞 it’s identifiers for the other system that receives that string
sort of a template
a

Alowaniak

01/18/2019, 12:29 PM
yea so you could do
"""
“${'$'}{somthing}”
"""
u

Uzi Landsmann

01/18/2019, 12:29 PM
Ok thanks, I’ll try it out
k

karelpeeters

01/18/2019, 12:29 PM
Wow that is surprising behavior.
u

Uzi Landsmann

01/18/2019, 12:56 PM
Thanks! It worked. But the way Intellij pastes the yaml is really strange. It adds the
{'$'}
in the wrong place and omits them where needed. But I guess it’s a question for another channel. Thanks again!