TSubstringList.Find Method

function Find(const S: string; var Index: Integer): Boolean; overload;

Searches a sorted list for S by bisection.

#NameDescription
1S

The text, every text kind.

2Index

The equal item's index, else the index S would be inserted at.

Returns: Boolean - True when an item equals S.

Examples

Finding in a sorted list.

uses Substr;

procedure Example;
var List: TSubstringList;
    i: Integer;
begin
    List := TSubstringList.Create(4);
    try
        List.Sorted := True;
        List.Add('c');
        List.Add('a');
        Assert(List.Find('c', i));
        Assert(i = 1);
        Assert(not List.Find('b', i));
        Assert(i = 1);
    finally
        List.Free;
    end;
end;
See Also: TSubstringList.IndexOf, TSubstringList.Sorted