You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Kok Hoor <ko...@solutionx.com.my> on 2004/01/19 03:40:54 UTC

Escaping single quote or double quote (' or '')

Hi all,

    I am quite new to velocity, and I think what I am asking here is not
in
The documents.

    Is it possible to escape a single quote (') inside a single quoted
Expression, like this:

	'test\''

    Or 

	"test\""

    Thanks in advance.

Regards,
    Kok Hoor



---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Escaping single quote or double quote (' or '')

Posted by Mike Kienenberger <mk...@alaska.net>.
Kok Hoor <ko...@solutionx.com.my> wrote:
> Hi all,
> 
>     I am quite new to velocity, and I think what I am asking here is not
> in
> The documents.
> 
>     Is it possible to escape a single quote (') inside a single quoted
> Expression, like this:
> 
> 	'test\''
> 
>     Or 
> 
> 	"test\""
> 

I've used the following:

#set( $dollarSign = '$' )
#set( $poundSign = '#' )
#set( $doubleQuote = '"' )

I would imagine that you can also do the following although I've never 
tested it.

#set( $singleQuote = "'" )

In your example, it'd come out as

"test${singleQuote}"

or 

"test${doubleQuote}"


There is no \ notation for velocity (although the docs incorrectly stated 
that there was such a thing at one point).


-Mike

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org