home *** CD-ROM | disk | FTP | other *** search
- unit FindFile;
-
- interface
- uses Def, RE, UCasU;
- function FindInFile(var FindName: string): longint;
- (* essentially a binary search *)
-
- implementation
-
- function FindInFile;
- var First,
- Last,
- Middle,
- Lngth: longint;
- TestName: string;
- begin
- First := 0;
- Last := SortTop;
- Lngth := length(FindName);
- while (First + 1) < Last do
- begin
- Middle := (First + Last) div 2;
- GetRec(Entry,Middle);
- TestName := UCase(copy(Entry.Addressee,1,Lngth));
- if FindName > TestName then First := Middle else Last := Middle;
- end; (* end while *)
- (* FirstDisplay:=Last; *)
- FindInFile := Last;
- end;
-
- end.
-