Delphi提取字符串


本文整理自网络,侵删。

 

使用单元 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;  

相关阅读 >>

Delphi dbgrid查询内容的导出为txt函数

Delphi idhttp多线程下载

Delphi 软件welcome窗口代码

Delphi webservices传数据

Delphi中强制idhttp使用http1.1

Delphi goto 语句的使用

Delphi filestream

什么是嵌入式数据库

Delphi 几个实用的html解析函数

Delphi简单的字符串加密解密函数

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...