Delphi 取16进制字符的10进制的integer值


本文整理自网络,侵删。

 
(*********************取16进制字符的10进制的integer值*******************)
function HexToInt(HexStr:String):Integer;
var
  i,TempInt,LocalInt:Integer;
begin
  HexStr:=UpperCase(HexStr);
 
  LocalInt:=1;
  Result:=0;
  for i:=Length(HexStr) downto 1 do
  begin
    if HexStr[i] in ['0'..'9'] then
      TempInt:=StrToInt(HexStr[i])
    else
      TempInt:=Ord(HexStr[i])-Ord('A')+10;
 
    if i=Length(HexStr) then
      LocalInt:=1
    else
      LocalInt:=LocalInt*16;
 
    Result:=Result+TempInt*LocalInt;
  end;
end;
//*********************取16进制字符的10进制的integer值**************

相关阅读 >>

Delphi 双击dbgrid然后得到字段里面的内容

Delphi idftp 错误:socket error 10054 �c connection reset by peer -连接被重置

Delphi 判断文本文件的编码格式

Delphi获取图片的真实类型

Delphi readprocessmemory用法

Delphi 查看字符串在不同编码(ascii、unicode、utf7、utf8、default、bigendianunicode)下的 hex

Delphi根据url获取缓存文件的方法

Delphi sysutils.wraptext - 换行

推荐一套免费跨平台的Delphi 哈希及加密算法库

Delphi trimleft 删除字符串左边的空格

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



打赏

取消

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

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

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

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

评论

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