You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Fabio Canepa <fa...@igate.it> on 2006/11/13 17:28:02 UTC

String literals containing double quotes

Hello,
I'm trying to #set a reference to a string literal containing a " 
(double quote) character. How can I escape it?
Sorry, I haven't found anything about this in the user guide, and '\' 
seems not working with double quotes.

Regards,
Fabio

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


Re: String literals containing double quotes

Posted by Nathan Bubna <nb...@gmail.com>.
In the upcoming 1.5 release, you can just double up your quotes to escape them:

#set( $foo = "The man said, ""Jump!""  ""No,"" said I.")

On 11/13/06, Barbara Baughman <ba...@utdallas.edu> wrote:
> Instead of the big section on escaping, perhaps the documentation
> should have the great workaround we have.
>
> #set($q='""')
> #set($d='$')
>
> Then when you need the special character, use $q or $d instead of
> figuring out escaping and using double quotes or dollar sign directly.
>
> Barbara Baughman
> X2157
>
> On Mon, 13 Nov 2006, Fabio Canepa wrote:
>
> > Hello,
> > I'm trying to #set a reference to a string literal containing a "
> > (double quote) character. How can I escape it?
> > Sorry, I haven't found anything about this in the user guide, and '\'
> > seems not working with double quotes.
> >
> > Regards,
> > Fabio
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> > For additional commands, e-mail: user-help@velocity.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>

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


Re: String literals containing double quotes

Posted by Barbara Baughman <ba...@utdallas.edu>.
Instead of the big section on escaping, perhaps the documentation
should have the great workaround we have.

#set($q='""')
#set($d='$')

Then when you need the special character, use $q or $d instead of
figuring out escaping and using double quotes or dollar sign directly.

Barbara Baughman
X2157

On Mon, 13 Nov 2006, Fabio Canepa wrote:

> Hello,
> I'm trying to #set a reference to a string literal containing a "
> (double quote) character. How can I escape it?
> Sorry, I haven't found anything about this in the user guide, and '\'
> seems not working with double quotes.
>
> Regards,
> Fabio
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>

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