- 人气:
- 放大
- 缩小
- 二维码
- 赞赏
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":"','",');