Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Escape a dollar sign in string interpolation

People also ask

How do you escape the dollar sign?

You can escape dollar signs with a backslash or with another dollar sign. So $, $$, and \$ all replace with a single dollar sign.

How do you escape a Scala string interpolation?

Interpolations use this escape to splice in arguments, and it can also be used to escape itself as the sequence $$ to represent a literal $ character. Because of its special handling during the parse, the $ could be used to escape a " character to represent a literal " withing a string.

How do you escape the dollar sign in terraform?

route_name} as literally ${var. route_name} , and not as a string interpolation at all. To avoid this, you can use any strategy that causes the initial $ to be separate from the following ${ , so that Terraform will understand the first $ as a literal and the remainder as an interpolation sequence.

How do you escape the dollar sign in Kotlin?

Kotlin has "multiline strings". All of the Kotlin strings support string interpolation with the $ character. It can be escaped as \$ in single line strings, but cannot be currently escaped withing multiline strings.


Just double it

scala> val name = "foo"
name: String = foo

scala> s"my.package.$name$$"
res0: String = my.package.foo$

Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!