procedure replace_word(next_word: string); var next_word_rus: string; ER :TStrings;
begin ER:=TStringList.Create; ER.LoadFromFile('voc.txt'); next_word_rus:=ER.Values[next_word]; if next_word_rus='' then next_word_rus:=next_word; Memo2.Lines.Add(next_word_rus); er.free
end;
procedure TForm1.Button1Click(Sender: TObject);
var s, next_word: string; i: byte; currLine: integer;
begin For currLine := 0 To Pred(memo1.Lines.Count) Do Begin s := memo1.Lines.Strings[currLine]; i := 1; next_word := ''; while i <= length(s) do begin if upcase(s[i]) in ['A'..'Z'] then begin next_word := next_word + s[i]; inc(i) end else begin if next_word <> '' then replace_word(next_word); Memo2.Lines.Add(s[i]); next_word := ''; inc(i); end; end;
if next_word <> '' then replace_word(next_word); end; end;