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)
 
Parameters:

String

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.

Delimiter

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.

Count

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( )
 
Examples:

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

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