在 scala play 框架中格式化字符串并用 html 元素替换 %s
Format a string and replace %s with html element in scala play framework
我有一个像 "User: %s" 这样的字符串,我想格式化它并用像 <a href="#">John</a>
这样的东西替换“%s”。我应该如何在视图文件中执行此操作?
P.S。我正在使用 "User: %s".format("John")
但浏览器呈现 I am <a href="#">John</a>
而不是 "I am John".
要在模板中输出原始 html:
<p>
@Html(article.content)
</p>
我有一个像 "User: %s" 这样的字符串,我想格式化它并用像 <a href="#">John</a>
这样的东西替换“%s”。我应该如何在视图文件中执行此操作?
P.S。我正在使用 "User: %s".format("John")
但浏览器呈现 I am <a href="#">John</a>
而不是 "I am John".
要在模板中输出原始 html:
<p>
@Html(article.content)
</p>