You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Ben <ne...@gmail.com> on 2005/01/09 12:05:21 UTC
String Array in Velocity
Hi
I have a String Array, how can I retrieve its value if I know the index?
Say I have this:
String[] values = new String[] { "1", "2" }
I have tried using this but it didn't work:
$values[1]
Thanks
Ben
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: String Array in Velocity
Posted by Ben <ne...@gmail.com>.
Thanks heaps.
Ben
On Sun, 9 Jan 2005 22:25:44 +0900, Shinobu Kawai
<sh...@gmail.com> wrote:
> Hi Ben,
>
> > I have a String Array, how can I retrieve its value if I know the index?
> >
> > Say I have this:
> >
> > String[] values = new String[] { "1", "2" }
> >
> > I have tried using this but it didn't work:
> >
> > $values[1]
>
> Velocity currently does not support direct access to array elements.
> For now, you can use the ArrayTool.
> http://wiki.apache.org/jakarta-velocity/ArrayTool
>
> $array.get($values, 1)
>
> Best regards,
> -- Shinobu
>
> --
> Shinobu "Kawai" Yoshida <sh...@gmail.com>
>
> ---------------------------------------------------------------------
> 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
Re: String Array in Velocity
Posted by Shinobu Kawai <sh...@gmail.com>.
Hi Ben,
> I have a String Array, how can I retrieve its value if I know the index?
>
> Say I have this:
>
> String[] values = new String[] { "1", "2" }
>
> I have tried using this but it didn't work:
>
> $values[1]
Velocity currently does not support direct access to array elements.
For now, you can use the ArrayTool.
http://wiki.apache.org/jakarta-velocity/ArrayTool
$array.get($values, 1)
Best regards,
-- Shinobu
--
Shinobu "Kawai" Yoshida <sh...@gmail.com>
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org