velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nathan Bubna" <nbu...@gmail.com>
Subject Re: How to escape double quote(")
Date Tue, 30 Oct 2007 18:54:22 GMT
the simplest way is to do either:

context.put("Q", "\"");

or

#set( $Q = '"' )

and then do:

#set( $var = "field.equals(${Q}abcdbbbbb${Q});" )

On 10/30/07, Kadve, Ketaki Sheshrao <KetakiKadve@fairisaac.com> wrote:
> Hi,
>
> We are trying to use #set to write some Java code.
>
> We want to do something like this:
>
>
>
> #set ($var = "field.equals ( "abcdbbbbb" ) ");
>
>
>
> And then we want to use $var in if statement as follows:
>
>
>
> if ($var)
>
>    cnt = 0;
>
>
>
> The problem is Velocity does not allow to use double quotes ( " ) inside
> String defined in #set. Escape characters are also not working.
>
> So we get error at second double quote (in Green), suggesting that it
> should be the end of String defined for $var.
>
> #set ($var = "field.equals ( "abcdbbbbb" ) ");
>
>
>
>
>
> Thanks in advance.
>
>
> This email and any files transmitted with it are confidential, proprietary
> and intended solely for the individual or entity to whom they are addressed.
> If you have received this email in error please delete it immediately.
>
>

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


Mime
View raw message