delphi HexToInt


本文整理自网络,侵删。

 
function HexToInt(const HexStr: string): LongInt;
var
  iNdx: integer;
  cTmp: Char;
begin
  Result := 0;
  for iNdx := 1 to Length(HexStr) do begin
    cTmp := HexStr[iNdx]; // 字符串string内存中的第一位是length标识
    case cTmp of
      '0'..'9': Result := 16 * Result + (Ord(cTmp) - $30);
      'A'..'F': Result := 16 * Result + (Ord(cTmp) - $37);
      'a'..'f': Result := 16 * Result + (Ord(cTmp) - $57);
    else
      raise EConvertError.Create('Illegal character in hex string');
    end;
  end;
end;

相关阅读 >>

Delphi app 横屏和竖屏

Delphi指针长度

Delphi 搜索某个字的位置 [带重复]

Delphi 使用泛型的 tarray 从动态数组中查找指定元素

Delphi idhttp post 提交 json

Delphi xe5 android openurl

Delphi 截取两个字符之间的内容

Delphi 字符串是否包含

Delphi android 安卓中保持屏幕常亮

Delphi xe 在andriod程序中获取外置sd卡根目录

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



打赏

取消

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

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

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

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

评论

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

    正在狠努力加载,请稍候...