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和金山词霸制作批量单词翻译

Delphi 打开webbrowser的选中文件路径

Delphi 根据delta自动生成sql语句

Delphi 判断字符是否是数字

Delphi 获取临时文件夹路径

Delphi 映像劫持编辑器

Delphi 获取两字符串之间的内容

Delphi下载官方svn中的示例原码

Delphi 下载整个网站图片例子

Delphi twebbrowser 获取cookie

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



打赏

取消

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

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

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

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

评论

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