You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by Colin Chalmers <co...@maxware.nl> on 2001/07/25 14:51:31 UTC

concatating strings

Hi,

I have to add a number of strings from a template into one long string and am experiencing a number of problems. 

For example if I define as such

000000112012010Interpay$firstKey0039252677$second

Things go wrong since Velocity can't find the keys. Not surprising!!

so I would rather have

$firstKey  = colin
$second = chalmers

000000112012010Interpay $firstKey 0039252677 $second

to produce try to produce the following

000000112012010Interpaycolin0039252677chalmers

I was looking at a texentask similiar to the example on the site to do this from an app but I am not getting the output I expected.

Any tips on this?

/Colin



Re: concatating strings

Posted by Colin Chalmers <co...@maxware.nl>.
Solved, coooool thanx!!

/Colin

----- Original Message -----
From: "Simon Christian" <si...@cpd.co.uk>
To: <ve...@jakarta.apache.org>
Sent: Wednesday, July 25, 2001 3:36 PM
Subject: Re: concatating strings


> You should use the Formal Reference Notation - enclose your references
> in {} brackets.
>
> in this case:
>
> 000000112012010Interpay${firstKey}0039252677${second}
>
> will cover it
>
> check
>
http://jakarta.apache.org/velocity/user-guide.html#Formal%20Reference%20Nota
tion
> for more info
>
> - simon
>
>
>
> Colin Chalmers wrote:
> >
> > Hi,
> >
> > I have to add a number of strings from a template into one long string
and am experiencing a number of problems.
> >
> > For example if I define as such
> >
> > 000000112012010Interpay$firstKey0039252677$second
> >
> > Things go wrong since Velocity can't find the keys. Not surprising!!
> >
> > so I would rather have
> >
> > $firstKey  = colin
> > $second = chalmers
> >
> > 000000112012010Interpay $firstKey 0039252677 $second
> >
> > to produce try to produce the following
> >
> > 000000112012010Interpaycolin0039252677chalmers
> >
> > I was looking at a texentask similiar to the example on the site to do
this from an app but I am not getting the output I expected.
> >
> > Any tips on this?
> >
> > /Colin
>


Re: concatating strings

Posted by Simon Christian <si...@cpd.co.uk>.
You should use the Formal Reference Notation - enclose your references
in {} brackets.

in this case:

	000000112012010Interpay${firstKey}0039252677${second}

will cover it

check
http://jakarta.apache.org/velocity/user-guide.html#Formal%20Reference%20Notation
for more info

- simon



Colin Chalmers wrote:
> 
> Hi,
> 
> I have to add a number of strings from a template into one long string and am experiencing a number of problems.
> 
> For example if I define as such
> 
> 000000112012010Interpay$firstKey0039252677$second
> 
> Things go wrong since Velocity can't find the keys. Not surprising!!
> 
> so I would rather have
> 
> $firstKey  = colin
> $second = chalmers
> 
> 000000112012010Interpay $firstKey 0039252677 $second
> 
> to produce try to produce the following
> 
> 000000112012010Interpaycolin0039252677chalmers
> 
> I was looking at a texentask similiar to the example on the site to do this from an app but I am not getting the output I expected.
> 
> Any tips on this?
> 
> /Colin