delphi xe HTTPEncode


本文整理自网络,侵删。

 
function HTTPEncode(const AStr: String): String;
const
  NoConversion = ['A'..'Z','a'..'z','*','@','.','_','-','0'..'9','$','!','''','(',')'];
var
  Sp, Rp: PAnsiChar;
begin
  SetLength(Result, Length(AStr) * 3);
  Sp:= PAnsiChar(AStr);
  Rp:= PAnsiChar(Result);
  while Sp^ <> #0 do
  begin
    if Sp^ in NoConversion then
      Rp^ := Sp^
    else
      if Sp^ = ' ' then
        Rp^ := '+'
      else
      begin
        FormatBuf(Rp^, 3, '%%%.2x', 6, [Ord(Sp^)]);
        Inc(Rp,2);
      end;
    Inc(Rp);
    Inc(Sp);
  end;
  SetLength(Result, Rp - PAnsiChar(Result));
end;
function URLEncode(const Url: String): String;
begin
  Result:= HttpEncode(UTF8Encode(Url));
end;

相关阅读 >>

Delphi bintohex和hextobin

Delphi 10 seattle中录制音频

Delphi 检查输入的ip地址串是否合法

Delphi提取二值图像轮廓

Delphi 获取计算机名称3

Delphi代码,直截注入别的进程,之后直截运行在别的进程中的代码

Delphi的datetostr strtodate格式灵活用法

Delphi 调用cmd命令行并取得返回结果

Delphi 在firemonkey应用程序中使用torientationsensor获取设备倾斜和指南针航向

createremotethread远程注入例子

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



打赏

取消

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

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

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

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

评论

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