What is the cleanest method for adding a $
character in a string literal?
The best solution I've come up with so far is """${"$"}..."""
, which looks ugly to me.
To escape the dollar sign inside a string literal, use the backslash character:
"\$"
To escape it in a raw string literal ("""..."""
), the workaround you provided is indeed the easiest solution at the moment. There's an issue in the bug tracker, which you can star and/or vote for: KT-2425.