Delphi HexToInt32


本文整理自网络,侵删。

 
function HexToInt32(const aHex: string ):Integer;
var
  I,L,K: Integer;
begin
  Result := 0 ;
  if aHex ='' then
    begin
      Exit;
    end
  else
    begin
      K := 0;
      L := Length(aHex);
      for I:=1 to L do
        begin
          if (not(aHex[I] in['A'..'F'])) and (not(aHex[I] in['a'..'f'])) then
            K := K + Trunc(StrToInt(aHex[I]) * Power(16, L-I))
          else case aHex[I] of
            'a', 'A' : K := K + Trunc(10 * Power(16, L-I));
            'b', 'B' : K := K + Trunc(11 * Power(16, L-I));
            'c', 'C' : K := K + Trunc(12 * Power(16, L-I));
            'd', 'D' : K := K + Trunc(13 * Power(16, L-I));
            'e', 'E' : K := K + Trunc(14 * Power(16, L-I));
            'f', 'F' : K := K + Trunc(15 * Power(16, L-I));
          end;
        end;
    end;
  Result := k;
end;

相关阅读 >>

dll 的静态调用实例代码

Delphi 10.4.1的编译器bug终于修正了!

Delphi winexec 执行cmd

Delphi图像数据压缩解压缩实例

Delphi显示gif动画简单方法

Delphi 系统托盘 trayicon

Delphi png异形窗口

Delphi利用文件流把文件拆分与合并

Delphi检查程序内存泄露 checkmem.pas

python4Delphi 示例应用程序在 Delphi 应用程序中运行简单的 python 脚本

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



打赏

取消

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

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

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

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

评论

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