You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by trad-ex <tr...@inter7.jp> on 2006/05/25 08:13:24 UTC

How can I get the length of Array ?

Hi all,

In the Velocity realm, how can I get the length of Array ?
For instance,

#set( $arr = __set int[] value__ )
#if( $arr.length > 0 )
 ...(snip)...
 
$arr.length is always null. Why ?
I always use helper Object to avoid this issue.
For example, 

$helperObj.lengthOf( $arr )

This method, lengthOf, is described below:

 public int lengthOf( Object[] objects )
 {
   if( objects == null)
     return 0;
   return objects.length;
 }
 
Best Regards,
trad-ex


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