velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christoph Reck <Christoph.R...@dlr.de>
Subject Re: " character
Date Mon, 11 Mar 2002 08:07:15 GMT
The current way of getting a quote into a string is using
a formal declaration:

#set( $Q = '"' )
#set( $foo="$Q$toto" )

Note that anything within single quotes in a VTL parameter (within 
a set or in a method call) will not be touched by Velocity.
so you can also write #set($foo='"hello').

Note that I use a similar trick to get newlines into strings:
#set( $NL = $forms.uudecode('%0A') )## $forms is a user written context tool.

Hope this helps,
:) Christoph

Sebastien Chassande-Barrioz wrote:
> 
> hi,
> 
> I have a problem to set a variable with the " character:
> #set($toto="hello")
> #set($foo="\"${toto}")

#set( $foo="$Q$toto" )

> $foo
> 
> renders:
> \"hello

now renders:
"hello

> 
> but I would like just:
> "hello
> 
> The following other case occurs an error:
> #set($foo=""${toto}")
> 
> I does not find in the documentation any information about escaping the
> " character in a string. How is it possible ?
> 
> regards,
> Seb
> --
> Chassande-Barrioz Sebastien
> INRIALPES - SIRAC/SARDES Team - ObjectWeb initiative
> Mail job : sebastien.chassande@inrialpes.fr
> Phone : 04.76.61.55.16
> 
> --
> To unsubscribe, e-mail:   <mailto:velocity-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:velocity-user-help@jakarta.apache.org>

-- 
:) Christoph Reck

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


Mime
View raw message