Click here to return to the KiXtart HelpDesk main page...

KiXtart 2001 Manual

Split( )

Action: Returns a zero-based, one-dimensional array containing a specified number of substrings.
Syntax: SPLIT (“string”, “delimiter”, count)


Required. String expression containing substrings and delimiters. If expression is a zero-length string, Split returns an empty array, that is, an array with no elements and no data.


Optional. String character(s) used to identify substring limits. If omitted, the space character (" ") is assumed to be the delimiter. If delimiter is a zero-length string, a single-element array containing the entire expression string is returned.


Optional. Number of substrings to be returned; -1 indicates that all substrings are returned.

Remarks: The Split function doesn't actually create a variable -- all it does is create an array, and the parser copies that back into whatever variable the result is being assigned to. Therefore, if you want Split to populate an array and have that array's contents available outside the current scope, you must make the variable/array global prior to populating it with the split function (Example 2).

Returns: An array containing the substrings found in the input string.
See Also: UBound( )

; Example 1:
$Myarray = Split("aaa~~bbb~~ccc","~~")
For Each $Element In $MyArray
  ? $Element ; will display "aaa", "bbb" and "ccc"

; Example 2:
Global $Array2
$Array2 = Split("aaa~~bbb~~ccc")
For Each $Element In $Array2
  ? $Element ; will display "aaa", "bbb" and "ccc"