Re: How to search for a string in a text-file


Posted by Jean Claude Servaye on August 16, 2000 at 18:02:08:

In Reply to: How to search for a string in a text-file posted by eJREp48beLszc:festra on August 08, 2000 at 18:42:33:

var
F : TextFile;
A,B : String;
begin
B := 'StringToFind';
AssignFile(F,'YourTextFile.Txt';
Reset(F);
While not EOF(F) do begin
Readln(F,A);
If Pos(B,S) > 0 then
begin
//Your code here
Break // if you have only one string to search
end;
end;
CloseFile(F);
end;


Related Articles and Replies: