I would like to know how can i escape a # in velocity. Backslash seems to escape it but it prints itself as well
This:
\#\#
prints:
\#\#
I would like:
##
I would like to know how can i escape a # in velocity. Backslash seems to escape it but it prints itself as well
This:
\#\#
prints:
\#\#
I would like:
##
这个:
#[[
##
]]#
将产生:
##
#[[ ... ]]# 中的任何内容都未解析。
如果你不想打扰 EscapeTool,你可以这样做:
#set( $H = '#' )
$H$H
将 esc 工具添加到您的工具箱中,然后您就可以使用 ${esc.hash}
${esc.h} 将输出 # 按照
设置技术是绕过您需要转义的任何字符的好方法,例如,如果您想让 $name 后跟“_lastname”,那么您可以这样做:
set ($n = '_lastname)
并在你的模板中有这个:
$name$n
一切都很好。