This should be a really simple thing to do - determine the length of an array in Confluence/Velocity - but I'm struggling to figure it out!
I've tried 3 ways to find the length of an array (shown below) and the only way that works is via Method 3 (a horrible loop?)
N.B. the $list is a reference to (hopefully) the ListTool library, is it included in Confluence's version of Velocity? If not, how can I add it?
Can someone slap me upside the head and tell me what's wrong here?
Thanks
The Example Code
#set($keys = "AAA,BBB,CCC,DDD")
## Method 1
#set($arrayKeys = $keys.split(","))
#set( $countBySize = $arrayKeys.size() )
## Method 2
#set( $countbyList = $list.size($arrayKeys))
## Method 3
#set($countByKeys = 0)
#foreach ($key in $arrayKeys)
#set($countByKeys = $countByKeys + 1)
#end
The Results as Rendered

N.B. numKeys in the table should be countByKeys