velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Will Glass-Husain" <wgl...@forio.com>
Subject Re: simple question 2
Date Wed, 11 Oct 2006 13:26:56 GMT
The + operator for string concatenation is available in 1.5.  You can
download the beta

I prefer Christopher's solution, myself.

WILL

On 10/11/06, apache@recks.org <apache@recks.org> wrote:
> 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: apache@recks.org
> > 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: velocity-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>


-- 
Forio Business Simulations

Will Glass-Husain
wglass@forio.com
www.forio.com
Mime
View raw message