Delphi 根据开始和结束符取得中间字符串


本文整理自网络,侵删。

 
// 根据开始和结束符取得中间字符串
function CenterStr(const strSrc : String; const strBegin : String; const strEnd : String) : String;
var
    iPosBegin, iPosEnd: integer;
    strSrcLow, strBeginLow, strEndLow: String;
begin
    strSrcLow := LowerCase(strSrc);
    strBeginLow := LowerCase(strBegin);
    strEndLow := LowerCase(strEnd);

    iPosBegin := Pos(strBeginLow, strSrcLow) + Length(strBeginLow);
    iPosEnd := Pos(strEndLow, strSrcLow);

    result := Copy(strSrc, iPosBegin, iPosEnd - iPosBegin);
end;


增强功能
// 获取配置值
function GetConfigValue(const strSrc : string; strConfigName: string): string;
begin
    result := CenterStr(strSrc, '<' + strConfigName + '>', '<' + strConfigName + '>'); 
end;

相关阅读 >>

Delphi 2009 之 tcategorypanelgroup[3]: color

Delphi httpserver 使用方法

Delphi isthisleapyear 判断闰年

Delphi创建证书密钥库文件

Delphi 解决timage无法在窗体resize时改变canvas的大小

减小Delphi xe5编译出来的程序体积

Delphi获取进程的命令行参数

Delphi实现阿里云印刷文字识别_身份证识别

Delphi 取bmp图片宽高

Delphi的unicode与gb2312转转换,汉字unicode转gb2312

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



打赏

取消

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

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

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

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

评论

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