A
abcduan
Unregistered / Unconfirmed
GUEST, unregistred user!
多谢远帆兄及各位?
下面远帆兄写的
procedure TMainform.Button2Click(Sender: TObject);
const
Signal = '名称: 电话: 地址: 产品: 详细信息: 网址: 电邮: ';
var
Fi: TFileStream;
FS, MLen, Bock, m, n: Integer;
TiTle, Memo: string;
Buff, BP: ^char;
OP: Boolean;
begin
Bock := 0;
MLen := 0;
OP := False;
Fi := TFileStream.Create('c:/1.htm', fmopenread);
FS := Fi.Size;
Buff := AllocMem(FS);
BP := Buff;
Fi.ReadBuffer(Buff^, FS);
Fi.Free;
for n := 1 to FS do
begin
case bp^ of
'< ': begin
if (bock = 0) and (MLen < > 0) then
begin
Dec(BP, MLen);
Memo := '';
for m := 1 to MLen do
begin
if (BP^< > #13) and (BP^< > #10) and (BP^< > #32) then Memo := Memo + BP^; //去掉回车换行、空格带来的影响
Inc(bp);
end;
if OP then
begin
memo1.Lines.Add(TiTle + memo);
OP := not (OP);
end
else
if Pos(Memo, Signal) < > 0 then
begin
TiTle := Memo;
OP := not (OP);
end;
end;
MLen := 0;
inc(bock);
end;
'> ': dec(bock);
'{': inc(bock);
'}': dec(bock);
else
if bock = 0 then Inc(MLen);
end;
inc(bp);
end;
FreeMem(Buff);
end;
//哪位能解释一下,小弟不才
下面远帆兄写的
procedure TMainform.Button2Click(Sender: TObject);
const
Signal = '名称: 电话: 地址: 产品: 详细信息: 网址: 电邮: ';
var
Fi: TFileStream;
FS, MLen, Bock, m, n: Integer;
TiTle, Memo: string;
Buff, BP: ^char;
OP: Boolean;
begin
Bock := 0;
MLen := 0;
OP := False;
Fi := TFileStream.Create('c:/1.htm', fmopenread);
FS := Fi.Size;
Buff := AllocMem(FS);
BP := Buff;
Fi.ReadBuffer(Buff^, FS);
Fi.Free;
for n := 1 to FS do
begin
case bp^ of
'< ': begin
if (bock = 0) and (MLen < > 0) then
begin
Dec(BP, MLen);
Memo := '';
for m := 1 to MLen do
begin
if (BP^< > #13) and (BP^< > #10) and (BP^< > #32) then Memo := Memo + BP^; //去掉回车换行、空格带来的影响
Inc(bp);
end;
if OP then
begin
memo1.Lines.Add(TiTle + memo);
OP := not (OP);
end
else
if Pos(Memo, Signal) < > 0 then
begin
TiTle := Memo;
OP := not (OP);
end;
end;
MLen := 0;
inc(bock);
end;
'> ': dec(bock);
'{': inc(bock);
'}': dec(bock);
else
if bock = 0 then Inc(MLen);
end;
inc(bp);
end;
FreeMem(Buff);
end;
//哪位能解释一下,小弟不才