velocity-user  

Re: simple question 2

apache
Wed, 11 Oct 2006 05:36:47 -0700

As simple as this:
#set( $products="$products,$user.productName" )

See more at:
http://jakarta.apache.org/velocity/docs/user-guide.html#String%20Concatenation

I do remember having seen the "+"-operator implemented
for string concatenation, can someone geve me a pointer
or state if 1.5 will have this enabled?

Cheers,
Christoph

P.S. to create a string with a comma separated list I use:
#set( $sep = "" )
#set( $string="" )
#foreach( $item in $list )
#set( $string="$string$sep$item" )
#set( $sep = ", " )
#end

Arkadiusz Ryćkowski wrote:
--- Oryginalna wiadomość ---
Od: [EMAIL PROTECTED]
Do: Velocity Users List <velocity-user@jakarta.apache.org>
Wysłano: 2006-10-11 13:35:31
Temat: Re: simple question

your string matches Velocity semantics up to the "(",
and that is why the parser has trouble witch what comes
afterwards.

Just replace the initial "$" to soothe the barking parser:
#set( $D = '$' )
....

Many thanks
Last question, how to do sth like
#set ($products=$products + "," + $user.productName)
I'v tried i.e.
#set ($products=$products${COMMA}$user.productName)
and $products.concat($user.productName) but without expected effect

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]