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 sysutils.wraptext - 换行

Delphi 简单的操作memo1剪切 复制 粘贴 撤销 全选 清空

Delphi'控件的相对坐标与屏幕坐标转换

Delphi 清除ie缓存 internet临时文件 cookie 历史记录 表单记录 上网密码

Delphi利用webbrowser登陆qq群文档

Delphi richedit接受消息的问题

Delphi 任务管理器 获取窗口标题 获取窗口图标

Delphi 取键盘值

Delphi unigui日志的控制

Delphi 返回程序执行参数的例子

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



打赏

取消

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

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

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

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

评论

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