You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Akshay Kapur <ak...@cisco.com> on 2003/01/21 02:28:23 UTC

Escape " in velocity

In a .vm template, I want to assign a string with double quotes in it to a 
velocity variable. How do I do this? (Conceptually similar to what I am 
doing below but obviously, the one below doesn't work)

#set( $x = " Title: "Time" " )


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Escape " in velocity

Posted by Johnny Quazar <qu...@bitblaster.com>.
Try this:

#set( $quote = '"' )
#set( $x = " Title: ${quote}Time${quote} ")

...should do the trick. Of course you don't need the curly brackets 
if there are spaces around where you need to expand $quote but just 
always use them so you don't have think about this special case.

Yes?

At 5:28 PM -0800 1/20/03, Akshay Kapur wrote:
>In a .vm template, I want to assign a string with double quotes in 
>it to a velocity variable. How do I do this? (Conceptually similar 
>to what I am doing below but obviously, the one below doesn't work)
>
>#set( $x = " Title: "Time" " )
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>