TSubstringList.Remove Method

function Remove(const S: string): Integer; overload;

Deletes the first item equal to S.

#NameDescription
1S

The text, every text kind.

Returns: Integer - Its index, or -1 when there is none.

Examples

Removing by text.

uses Substr;

procedure Example;
var List: TSubstringList;
begin
    List := TSubstringList.Create(4);
    try
        List.Add('a');
        List.Add('b');
        List.Add('a');
        Assert(List.Remove('a') = 0);
        Assert((List.Count = 2) and (List[0] = 'b'));
        Assert(List.Remove('c') = -1);
    finally
        List.Free;
    end;
end;
See Also: TSubstringList.RemoveItem, TSubstringList.Delete, TSubstringList.Extract