Home > Language Reference > String Management Functions > SplitIntoArray

SplitIntoArray

The SplitIntoArray function splits a string into an array of substrings using a delimiter.

Usage

Used to split a long string into an array of words.  

Syntax

count=SplitIntoArray(<source_string>, <tab_string> [, <delimiter_string>])

Parameters

<source_string>, string, text to split.

<tab_string>, array of strings, result of the split. <tab_string> array must be declared at the beginning of the script using the Dim function.

<delimiter_string>, optional string, character used to identify substring limits. Default is the space character (" ").

Return value

count, optional integer, number of returned substrings.

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, to reinitialize the array named array$, use:
array$()=""

See also

Asc
Chr$
Encrypt
ExtractBetween$
InStr
InStrRev
LCase$
Left$
Len
LTrim$
Mid$
Replace$
Right$
RTrim$
Str$
Trim$
UCase$
Val

Examples

Dim splitstring$(10)
num=SplitIntoArray ("Hello TesTask, the powerful automation software",splitstring$())
' Returns in splitstring$(0) "Hello", in splitstring$(1) "TesTask,", 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;TesTask;powerful"
SplitIntoArray(a$,data$(),";")
' Returns in data$(0) "Hello", in data$(1) "TesTask", in data$(2) "powerful"