String.Split

Syntax

Split(Delimiters: String; [Options: StringSplitOption = 2]): Array;

Parameters

Delimiters. Delimiter.

Options. Parameter that determines how the delimiter is regarded. Parameters in the list are separated using the logical OR.

Description

The Split method splits the current string into a character substring array, using the specified delimiter.

Comments

When the method is executed, a dynamic string array is initialized to return work result. The number of array elements depends on the number of delimiters found in the string. Delimiters are not included into the set of elements of the returned array, instead of them empty elements may be included (depends on the value of the Parameters parameter). After the array with obtained substrings is divided, result of the Split method work is available.

Example

Sub UserProc;
Var
    s: String;
    result: Array Of String;
Begin
    s := "AA_AB_ABC";
    result := s.Split("A_", StringSplitOption.NoEmpty Or StringSplitOption.Chars);
    For Each s In result Do
        Debug.Write("'" + s + "' ");
    End For;
End Sub UserProc;

On executing the example the "s" string is divided with using of the "A_" delimiter. Both characters "A" and "_" are regarded as delimiters when dividing the strings. Empty elements are excluded from the output array. The result is placed to the "result" array and displayed in the development environment console.

See also:

String