$WBSPLIT - convert string to array

Important: $WBSPLIT function has effect on entire WBSP page and all it's sub elements (configuration section, included files, sub reports, etc.). All instances of $WBSPLIT function that use the same array name will set same array regardless of their location inside WBSP page.

Availability
$WBSPLIT is available for use with all WBSP commands.

Syntax
$WBSPLIT{data|arrayname|separator|showvar|sort}
$WBSPLIT[data|arrayname|separator|showvar|sort]

Parameters
data - the string value (text) to be split
arrayname - the name of the array where elements will be stored
separator - a string containing one or more characters to use in separating the string
showvar - optional parameter  - if set to true (T,ON,1) WhizBase will show the last index (length-1) of resulting array
sort - optional parameter - if it exists WhizBase will sort the resulting array ascending (sort=A) or descending (sort=D). Any other sort value will be ignored.

Returns
Number of elements in resulting array if showvar parameter is set to true, otherwise it returns nothing, just creates the array.

Example

<!--
[FormFields]
wb_command=R
-->
<!--WB_BeginTemplate-->
<html>
<head>
<title>WBSplit</title>
</head>
<body>
$wbsetv[filecount|0]
$wbwhile[$wbgetv[filecount]<=$wbsplit[$wbdir[]|dirlist|,|t|A]
|
$wbgetv[dirlist($wbgetv[filecount])]<br>
$wbsetv[filecount|$wbcalc[$wbgetv[filecount]+1]]
]
</body>
</html> 

After running this example, the resulting page in browser should contain the list of all files in the directory where current WBSP file is located.