Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to escape a # in velocity

Tags:

velocity

People also ask

How do you escape special characters?

Escape CharactersUse the backslash character to escape a single character or symbol. Only the character immediately following the backslash is escaped. Note: If you use braces to escape an individual character within a word, the character is escaped, but the word is broken into three tokens.

How do you escape inside a string?

\ is a special character within a string used for escaping. "\" does now work because it is escaping the second " . To get a literal \ you need to escape it using \ .


this:

#[[
##
]]#

will yield:

##

anything within #[[ ... ]]# is unparsed.


If you don't want to bother with the EscapeTool, you can do this:

#set( $H = '#' )
$H$H

Maybe, the following site helps? http://velocity.apache.org/tools/1.4/generic/EscapeTool.html


Add the esc tool to your toolbox and then you can use ${esc.hash}