Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to escape a string for use in XML/HTML document in Scala?

Specifically, what's the easiest and most idiomatic way to replace special XML characters in a string. E.g., what's the easiest and most idiomatic way to convert <Jack & Jill> to &lt;Jack &amp; Jill&gt;.

like image 470
Chris W. Avatar asked Jun 25 '13 15:06

Chris W.


1 Answers

If you are looking to escape the @ sign in a scala.html file, for instance, using Scala/Play, do @@.

And give the person who provided this answer here How to print @ symbol in HTML with play framework (scala) an upvote.

I came across this page while looking for the above answer, so I just wanted to duplicate it here since other people may end up here as well.

like image 195
DowntownDev Avatar answered Oct 25 '22 09:10

DowntownDev