Hell, I am new to play framework and Scala. I don't know how to display special characters like @, -, "" as text. Help!
Asked
Active
Viewed 811 times
1
-
In what situation are you displaying these characters? – APerson Sep 29 '14 at 01:56
-
For example, when I want to display email address such as example@gmail.com, Scala assumes that @gmail.com is a variable. – Lucy_learning Sep 29 '14 at 02:48
-
1possible duplicate of [How to escape the "@" in play framework templates?](http://stackoverflow.com/questions/17077132/how-to-escape-the-in-play-framework-templates) – Michael Zajac Sep 29 '14 at 02:59
-
1Not only is this one of the first things to come up in a search on StackOverflow, but it's also clearly stated in the docs: https://www.playframework.com/documentation/2.3.x/ScalaTemplates – Michael Zajac Sep 29 '14 at 03:01
1 Answers
0
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: \"

user3366706
- 1,529
- 3
- 31
- 54