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;

相关阅读 >>

Delphi removeinvalid截取字符串某个字符前面的字符

Delphi如何获取系统服务(即service服务程序)列表

Delphi 获取打开文件的pid

Delphi tdatetime 日期时间值的比较

Delphi gmt时间与tdatetime转换

Delphi 2009 查看所有 unicode 字符

Delphi 字串转16进制

Delphi学习sql语句 - insert、update、delete

Delphi idmessage1 idsmtp1 发送邮件支持https

qdac项目

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



打赏

取消

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

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

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

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

评论

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