本文整理自网络,侵删。
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 使用泛型的 tarray 从动态数组中查找指定元素
Delphi xe 在andriod程序中获取外置sd卡根目录
更多相关阅读请进入《Delphi》频道 >>