velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Bubna <nat...@esha.com>
Subject Re: determining odd/even position in foreach loop
Date Mon, 21 Jun 2004 15:43:19 GMT
Jason St. Louis said:
> Is there a built in way of determining whether the current iteration you
> are on is even or odd in a foreach loop?
...

as Will said, we did discuss this some weeks back, and the result was the new
Alternator and AlternatorTool in VelocityTools (but not in a released version
yet):

http://cvs.apache.org/viewcvs.cgi/jakarta-velocity-tools/src/java/org/apache/velocity/tools/generic/

those two classes are improvements on the old alternator support in Velocity:
http://jakarta.apache.org/velocity/api/org/apache/velocity/app/tools/VelocityFormatter.html

but there's also nothing wrong with just using the modulus operator.  it's my
understanding that this problem space is the primary reason that Velocity
supports that operator.

Nathan Bubna
nathan@esha.com


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Mime
View raw message