delphi webservices传base64字串


本文整理自网络,侵删。

 delphi webservices传base64字串


function CompressStrToBase64(sStr: string): string;
var
  M1: TMemoryStream;
  M0, M2: TStringStream;
begin
  Result := '';
  if sStr = '' then
    Exit;
  M0 := TStringStream.Create(sStr);
  M1 := TMemoryStream.Create;
  M2 := TStringStream.Create(' ');
  try
    M0.Position := 0;
    M1.Position := 0;
    ZCompressStream(M0, M1);
    M1.Position := 0;
    M2.Position := 0;
    EncodeStream(M1, M2);
    Result := M2.DataString;
  finally
    FreeAndNil(M0);
    FreeAndNil(M1);
    FreeAndNil(M2);
  end;
end;
 
function DeCompressBase64ToStr(sStr: string): string;
var
  M0, M1: TStringStream;
  M2: TMemoryStream;
begin
  Result := '';
  if sStr = '' then
    Exit;
  M0 := TStringStream.Create('');
  M1 := TStringStream.Create(sStr);
  M2 := TMemoryStream.Create;
  try
    M1.Position := 0;
    M2.Position := 0;
    DeCodeStream(M1, M2);
    M0.Position := 0;
    M2.Position := 0;
    ZDecompressStream(M2, M0);
    Result := M0.DataString;
  finally
    FreeAndNil(M0);
    FreeAndNil(M2);
    FreeAndNil(M1);
  end;
end;

相关阅读 >>

Delphi idhttp读取网页重定向

Delphi中执行javascript代码

Delphi indy 组件包里的 idhttp 组件使用 get 方法下载文件限速的方法

Delphi controls 属性与继承 tshape 类的小练习

Delphi 10进制数与33进制数的转换

Delphi 清空某个form的控件内容,用tag来判断

Delphi 程序嵌入桌面效果的实现

Delphi 中文姓名 合法性检查

Delphi 如何从html格式的字符串中提取纯文本?

Delphi webbrowser添加到收藏夹

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



打赏

取消

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

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

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

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

评论

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