val s = """ """Shom """
gives
:1: error: ';' expected but string literal found. val s = """ """Shom"""
Tried to escape
val s = """ ""\"Shom """
result is not as expected.
s: String = " ""\"Shom"
val s = """ """Shom """
gives
:1: error: ';' expected but string literal found. val s = """ """Shom"""
Tried to escape
val s = """ ""\"Shom """
result is not as expected.
s: String = " ""\"Shom"
Try with s
string interpolator
val tripleQuote = """"""""" // 9 quotes in total
s"""${tripleQuote}Shom"""
res2: String = """Shom
or even inline it
s"""${"""""""""}Shom"""
s"""${List.fill(3)('"').mkString}Shom"""
s"""${"\""*3}Shom"""
which all output
"""Shom
because s
String interpolators can take arbitrary expressions
s"meaning is ${41 + 1}"
// res4: String = meaning is 42