Цитата:
Сообщение от Bars1992
Код:
procedure TForm1.Button1Click(Sender: TObject);
var
i,b,e:integer;
begin
b:=0;
e:=0;
for i:=0 to memo1.Lines.Count-1 do
begin
if pos('end',memo1.Lines[i])<>0 then inc(e);
if pos('begin',memo1.Lines[i])<>0 then inc(b);
end;
showmessage('Begin count= '+inttostr(b)+' end count= '+inttostr(e));
end;
|
Твой алгоритм проверяет на жесткое нахождение хотя бы одного слова в строке, а если в строке два end-а? или два begin-а?