function HexToInt(S: String): Integer; begin result := StrToInt('$' + S); end;
你在转换一次不久得了? IntTostr(StrToInt('$' + S))
S := Chr(Inttostr('$'+'D5C5'))
{十六进制转换为十进制} function HexToInt(const aHex: string): Integer; var I,L,K: Integer; begin Result := 0; if aHex = '' then Exit; 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; Result := K; end;
begin
result := StrToInt('$' + S);
end;
IntTostr(StrToInt('$' + S))
function HexToInt(const aHex: string): Integer;
var
I,L,K: Integer;
begin
Result := 0;
if aHex = '' then Exit; 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; Result := K;
end;
S:='A5';
StrToIntDef('$'+S, 0);http://lysoft.7u7.net