If I got your question right, you are asking how to escape special characters in scala. It's pretty much same as other languages. using escape character \

val str = " \\\" "     //output str: \"

or follow the below special syntax to store in string value with exactly what is inside the triple quotes.

val str = """ \" """   //output str: \"

Related Query

More Query from same tag