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 tgauge类的定义在哪个单元中定义的?

Delphi调用外部程序并等待其运行结束

Delphi messagebox 和 messagedlg用法

Delphi 实现卸载windows应用程序(类似360软件管家-卸载程序)

Delphi 如何从url提取文件名?

Delphi 将文件转换成base64编码

Delphi关闭进程

Delphi 判断是否为空('none', 'null', '')

Delphi winsock api写的邮件发送单元

Delphi 2010下使用sqlitesimpleDelphi连接sqlite数据库及中文乱码问题的解决

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



打赏

取消

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

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

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

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

评论

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