velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Geir Magnusson Jr." <ge...@optonline.net>
Subject Re: Stringing in VTL
Date Thu, 22 Feb 2001 13:41:55 GMT
Arik Levin wrote:
> 
>         Hi.
>                 I need to set dome strings together. Can I do that ?
>                 for example: Something like that..  $set ($a = $a + "abc" + "def") etc..

You can : just put them together :

#set( $a = "${foo}abcdef")

I used the 'formal notation' for the reference $foo as ${foo} because it
helps the parser realize you want 

$foo and not $fooabcdef

In general :

If not as an arg to a directive or velocimacro, just putting things
together is right :

 abcdef lalala ${foo}woogie


If an arg to a directive or VM, use " " if you want 'interpolated' or '
' if not

#set($foo = 1)
#set($a = "$foo"
)
#set($b = '$foo' )
$a
$b

will ouput

1
$foo

geir

geir

-- 
Geir Magnusson Jr.                               geirm@optonline.com

Developing for the web?  See http://jakarta.apache.org/velocity/

Mime
View raw message