Description
The SplitIntoArray
function converts the specified string into an array of strings.
Syntax
SplitIntoArray(
or
val = SplitIntoArray(
Parameters
<string$>
: string to be converted into an array.
<array$>
: array of strings which will contain the different splitted strings. The array must be declared at the beginning of the script using the Dim function.
<delimiter$>
: string. The space character (” “) is the delimiter by default. You can specify another delimiter character using this optional parameter (for example “;”).
Return Value
val
: integer, optional return value which gives the number of splitted strings.
Remarks
If you use successive SplitIntoArray
calls using the same array, you need to reinitialize the array to avoid some old values from the previous call if the second call returns less values. For example: array$() = ""
Examples
Dim splitstring$(10)
num = SplitIntoArray("Hello WinTask, the powerful automation software", splitstring$())
' Returns in splitstring$(0) "Hello", in splitstring$(1) "WinTask,", in splitstring$(2) "the",
' in splitstring$(3) "powerful", in splitstring$(4) "automation", in splitstring$(5) "software".
' And num contains 6.
Dim data$(10)
a$ = "Hello;WinTask;powerful"
SplitIntoArray(a$, data$(), ";")
' Returns in data$(0) "Hello", in data$(1) "WinTask", in data$(2) "powerful"