How to search for strings in a file , by keyword , using TDictionary . As it seems to me, the algorithm will work faster through TDictionary.
procedure TForm1.Button1Click(Sender: TObject); var Vhod, Vihod: TextFile; S: string; i: integer; Dictionary: TDictionary<string, integer>; begin if OpenDialog1.Execute then begin Dictionary := TDictionary<string, integer>.Create; AssignFile(Vhod, OpenDialog1.FileName); reset(Vhod); AssignFile(Vihod, ExtractFileDir(OpenDialog1.FileName) + '\svr_files.txt'); rewrite(Vihod); end; // Предполагаю что тут нужно подключить тут Dictionary := TDictionary<string, integer>.Create; while not Eof(Vhod) do begin ReadLn(Vhod, S); // Предполагаю что и тут нужно подключить if (Dictionary.ContainsKey(S)) then if (Pos('Что ищем', S) > 0) then writeln(Vihod, S); end; CloseFile(Vhod); CloseFile(Vihod); end;