TSubstringList.Clear Method

procedure Clear;

Deletes every item; the rows are kept, so the next adds take no memory.

Result: stored in self (calling object)

Remarks:

With OwnsObjects the objects are freed.

Examples

The rows stay for the next adds.

uses Substr;

procedure Example;
var List: TSubstringList;
begin
    List := TSubstringList.Create(2);
    try
        List.Add('a');
        List.Add('b');
        List.Clear;
        Assert((List.Count = 0) and (List.Capacity = 128));
        List.Add('c');
        Assert(List[0] = 'c');
    finally
        List.Free;
    end;
end;
See Also: TSubstringList.Delete, TSubstringList.Capacity