I recently played around with the Velocity template language available in the Roller Weblogger software powering blogging sites such as JRoller.com and was disappointed to realize that I wasn't able to access the elements of an array in anyway other than using a foreach loop.
This is what the
documentation suggests:
However, this approach fails because the object returned by the get() method is of type
String[]. So, I needed a way of getting the first element of the array. I couldn't figure out what would do it. I tried square brackets, get(0), and what not.
This is what I got working:
I wonder... Is there a better way? There has to be, right?