Delphi 取字符串中间


本文整理自网络,侵删。

 
function GetMidString(s: string; d: string; c: string): string; // 取字符串中间
var
  i, n: Integer;
begin
  try
    i := pos(d, s);
    n := pos(c, copy(s, i + 1, Length(s) - i));
    Result := copy(s, i + Length(d), n - Length(d));
  except
    Result := '';
  end;
end;


{
  "access_token": "1.a6b7dbd428f731035f771b8d********.86400.1292922000-2346678-124328",
    "expires_in": 2592000,
    "refresh_token": "2.385d55f8615fdfd9edb7c4b********.604800.1293440400-2346678-124328",
    "scope": "public audio_tts_post ...",
    "session_key": "ANXxSNjwQDugf8615Onqeik********CdlLxn",
    "session_secret": "248APxvxjCZ0VEC********aK4oZExMB",
}

str:=' "access_token": "1.a6b7dbd428f731035f771b8d********.86400.1292922000-2346678-124328",'

//用法 tok :=GetMidString(str,'access_token":"','",');

相关阅读 >>

Delphi第三方控件通用安装方法

Delphi 选择目录对话框(selectdirectory 函数)

Delphi 流与字符串

Delphi Delphi copy,pos,delete win api 版

Delphi idhttp多线程下载

Delphi 如何编写使stringgrid中的一列具有check功能,和checkbox效果一样

Delphi 复制动态数组

Delphi 调用批处理

Delphi内存映射 与 映射数据获取

Delphi判断字符串中是否包含汉字,并返回汉字位置

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



打赏

取消

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

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

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

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

评论

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