本文整理自网络,侵删。
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 removeinvalid截取字符串某个字符前面的字符
Delphi如何获取系统服务(即service服务程序)列表
Delphi学习sql语句 - insert、update、delete
Delphi idmessage1 idsmtp1 发送邮件支持https
更多相关阅读请进入《Delphi》频道 >>