velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nathan Bubna" <nat...@esha.com>
Subject Re: String to Int
Date Sat, 07 Dec 2002 02:50:51 GMT
Geir said:
>
> On Friday, December 6, 2002, at 01:08 PM, Johnny Dynn wrote:
>
> > Newbie question....
> >
> > Say I have a string in velocity...
> >
> > #set($num_loop = "5")
> >
> > How can I convert that so I can, for example, use it
> > in a foreach loop?
> >
> > eg.
> >
> > #foreach( $i in [1..$num_loop] )
> >   $i
> > #end
> >
> > I know I can just set the loop_count to 1 instead of
> > "1" but I was just curious if there some way.
>
> Velocity doesn't provide (by itself) any tools or utilities in the
> context for you to use.  The intent is that you can add your own to
> take care of the things that you need.  One strategy is to always
> provide a common toolbox for people to use.
...

well, velocity proper doesn't, but there is a MathTool in the Velocity Tool
subproject that provides easy string to int conversions without resorting to
sneaky hacks...  :-)

http://jakarta.apache.org/velocity/toolsubproject.html

Nathan Bubna
nathan@esha.com



--
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