Substr.SplitString Method

procedure SplitString(const S: Substring; const Delimiters: string; const List: TSubstringList); overload;

Splits S into List at every character of Delimiters, the empty parts included.

#NameDescription
1S

The text; it may be an item of List.

2Delimiters

The delimiter characters, every text kind.

3List

The list the parts are written into, cleared first; an empty S gives no part.

Result: stored in self (calling object)

Remarks:

S.Split with Delimiters' characters. An embedded #0 is a character, a delimiter only when Delimiters holds it.

Examples

Parts at any of two delimiters.

uses Substr;

procedure Example;
var List: TSubstringList;
begin
    List := TSubstringList.Create(8);
    try
        SplitString(Substring('a;b,c'), ',;', List);
        Assert(List.Count = 3);
        Assert(List[1] = 'b');
    finally
        List.Free;
    end;
end;