本文整理自网络,侵删。
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 2009 之 tcategorypanelgroup[5]: headerstyle
更多相关阅读请进入《Delphi》频道 >>