本文整理自网络,侵删。
使用单元 StrUtils
//提取字符串
function SubString(html,Cstr_L,Cstr_R:string):string;
var
sPosB,sPosE:integer;
Lwhtml,LwCstr_L,LwCstr_R:string;
begin
Result:='';
if trim(html)='' then exit;
Lwhtml:=LowerCase(html);
LwCstr_L :=LowerCase(Cstr_L);
LwCstr_R :=LowerCase(Cstr_R);
sPosB:=Pos(LwCstr_L,Lwhtml)+Length(LwCstr_L);
sPosE:=PosEx(LwCstr_R,Lwhtml,sPosB);
if (sPosB<sPosE) and (sPosE>0) then
Result:=copy(html,sPosB,sPosE-sPosB);
end;
相关阅读 >>
移植Delphi7的tclientsocket,tserversocket
更多相关阅读请进入《Delphi》频道 >>