///////下面是取得超连接个数的一个例子,你改进一下就可以procedure TForm1.Button1Click(Sender: TObject);
var
i,start1,count:integer;
FileNote:Tstringlist;
begin
count:=0;
FileNote:=TStringList.Create;
FileNote.LoadFromFile('f:\myapp\t2\aa.htm');
for i:=0 to FileNote.Count-1 do
begin
Label1.Caption:=inttostr(strlen(FileNote.GetText));
start1:=pos('href=',FileNote.Strings[i]);
if (start1<>0) then
count:=count+1;
Memo1.Lines.Add(FileNote.Strings[i]);
end;
showMessage('文件的总共有:'+inttostr(count)+'个超连接');
FileNote.Free;
end;
var
i,start1,count:integer;
FileNote:Tstringlist;
begin
count:=0;
FileNote:=TStringList.Create;
FileNote.LoadFromFile('f:\myapp\t2\aa.htm');
for i:=0 to FileNote.Count-1 do
begin
Label1.Caption:=inttostr(strlen(FileNote.GetText));
start1:=pos('href=',FileNote.Strings[i]);
if (start1<>0) then
count:=count+1;
Memo1.Lines.Add(FileNote.Strings[i]);
end;
showMessage('文件的总共有:'+inttostr(count)+'个超连接');
FileNote.Free;
end;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货