zoukankan      html  css  js  c++  java
  • delphi EncdDecd.pas单元中Encoding方法出现#$D#$A的解决方法

    例如:

    s:= 'http://detail.tmall.com/item.htm?id=45545826531&abbucket=_AB-M129_B17&acm=03130.1003.1.161728&aldid=4HatiDee&abtest=_AB-LR129-PV129_1393&scm=1003.1.03130.13_45545826531_161728&pos=6#detail';

    s:=Encoding(s);  //加密后的字符串中间就会多了#$D#$A,例如'ABCDDDD'#$D#$A'DDESDFGF'


    该单元为你的Delphi安装目录下,解决方法是将该单元放到你的程序源代码文件夹下,并Shift+F11在项目中添加该单元,这样就会引用你程序单元的EncdDecd.pas,而不会去引用delphi安装目录下的EncdDecd.pas单元。

     并且要增加一行代码,替换掉那个字符串:

    function EncodeString(const Input: string): string;
    var
      InStr, OutStr: TStringStream;
      str_result   : string;
    begin
      InStr := TStringStream.Create(Input);
      try
        OutStr := TStringStream.Create('');
        try
          EncodeStream(InStr, OutStr);
          str_result := OutStr.DataString;    
          str_result := StringReplace(str_result,#$D#$A,'',[rfReplaceAll,rfIgnoreCase]);  //增加代码!!!
          Result     := str_result;
        finally
          OutStr.Free;
        end;
      finally
        InStr.Free;
      end;
    end;

  • 相关阅读:
    字符串中部分字符替换
    斐波那契数列
    单列模式--代码
    selenium基础知识
    关于页面元素不能定位,通过Js进行处理
    Linux性能监控工具命令--top
    java实现selenium jquery滑动解锁
    PHP学习(三)——连接MySQL数据库理论
    PHP学习(二)
    PHP学习(一)
  • 原文地址:https://www.cnblogs.com/xtfnpgy/p/9285406.html
Copyright © 2011-2022 走看看