You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Jason Chodakowski <ja...@hyperworx.com> on 2005/04/11 16:56:37 UTC

Using foreach loops on String[][]

I didn't see this in the Velocity documentation but can string arrays of 
string arrays be iterated through via typical foreach handling or is it 
necessary to enumerate everything out. On that note, if I use 
Arrays.asList(String[][]) to put a List into the context, can I then 
access the individual String arrays as $Foo[0] $Foo[1]?

Thanks,

J --


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


Re: Using foreach loops on String[][]

Posted by Shinobu Kawai <sh...@gmail.com>.
Hi Jason,

> I didn't see this in the Velocity documentation but can string arrays of
> string arrays be iterated through via typical foreach handling or is it
> necessary to enumerate everything out. On that note, if I use
> Arrays.asList(String[][]) to put a List into the context, can I then
> access the individual String arrays as $Foo[0] $Foo[1]?

Is there a difference between your phrases "iterated through" and
"enumerate everything out"?  To me, it sounds the same, and yes, I
believe you can nest #foreach loops for that purpose.

As for getting the elements directly, check out the ListTool.  :)
    http://wiki.apache.org/jakarta-velocity/ListTool

Best regards,
-- Shinobu

--
Shinobu Kawai <sh...@gmail.com>

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