你怎么能转义javadoc中的@字符? [英] How can you escape the @ character in javadoc?
问题描述
如何转义 javadoc 中的 @
符号?我试图在 {@code}
标签中使用它,该标签位于 <pre>
标签内.
How can I escape the @
symbol in javadoc? I am trying to use it inside a {@code}
tag, which is inside <pre>
tags.
我已经尝试过 html 转义 @
序列,但是没有用.
I already tried the html escape @
sequence, but that didn't work.
推荐答案
使用 {@literal}
javadoc 标签:
Use the {@literal}
javadoc tag:
/**
* This is an "at" symbol: {@literal @}
*/
此 javadoc 将显示为:
The javadoc for this will read:
This is an "at" symbol: @
当然,这适用于任何字符,并且是显示任何特殊"字符的官方支持"方式.
Of course, this will work for any characters, and is the "officially supported" way of displaying any "special" characters.
这也是最直接的 - 您不需要知道字符的十六进制代码,并且您可以阅读您输入的内容!
It is also the most straighforward - you don't need to know the hex code of the character, and you can read what you've typed!
这篇关于你怎么能转义javadoc中的@字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!