function Lookup(S: string; Arr: array of string): Integer;
var
L, H, I, C: Integer;
begin
L := Low(Arr);
H := High(Arr);
Result := -1;
while L <= H do
begin
I := (L + H) shr 1;
C := AnsiCompareText(Arr[I], S);
if C < 0 then
L := I + 1
else if C > 0 then
H := I - 1
else
begin
Result := I;
Exit;
end;
end;
end;
var
L, H, I, C: Integer;
begin
L := Low(Arr);
H := High(Arr);
Result := -1;
while L <= H do
begin
I := (L + H) shr 1;
C := AnsiCompareText(Arr[I], S);
if C < 0 then
L := I + 1
else if C > 0 then
H := I - 1
else
begin
Result := I;
Exit;
end;
end;
end;