setlength(str,10);
setlength(hang,400);
str:=rzEdit1.Text;
for i:=0 to strList1.Count-1 do
begin
fir:=1;
beh:=1;
hang:=strList1;
rzEdit2.Text:=intToStr(length(hang));
if pos(str,hang)>0 then
begin
while (hang[beh]<>str)do
begin
if beh<=Length(hang) then
begin
if (hang[beh]=' ') then//等号右写一个空格就识别,写两个空格就不行
//,因为我的文本里面都是两个空格的
//现在写一个空格可以执行(#32也可以)
begin
left1:=copy(hang,fir,beh);
rzListBox1.Items.Add(left1);
fir:=beh;
end;
end;
inc(beh);
end;
end;
end;
程序可以执行
不过此程序执行到最后又会出现问题