In Scala 2 there is no straightforward way to represent a double-quote character "
in a quoted interpolation (except in triple-quote interpolation). A \
character can't be used for that because interpolators themselves decide how to handle escaping, so the parser doesn't know whether the "
character should be escaped or used as a terminator.
In Scala 3, we can use the $
meta character of interpolations to escape a "
character. Example:
val inventor = "Thomas Edison"
val interpolation = s"as $inventor said: $"The three great essentials to achieve anything worth while are: Hard work, Stick-to-itiveness, and Common sense.$""
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4