Function HexToDec(
const Value :Integer ) :
string;
var
s : string;
begin
s := '$' + IntToStr(Value);
Result := InToStr(StrToInt(s));
end;
(2)方法2
Funtion HexToDec( const Value :Integer) : string;
CONST HEX : ARRAY['A'..'F'] OF INTEGER =
(10,11,12,13,14,15);
VAR
str : String;
In : Integer;
i : integer;
BEGIN
Str := UpperCase(IntToStr(Value));
Int := 0;
FOR i := 1 TO Length(str) DO
IF str[i] < 'A' THEN
Int := Int * 16 + ORD(str[i]) - 48
ELSE
Int := Int * 16 + HEX[str[i]];
Result := IntToStr(Int);
end;
var
s : string;
begin
s := '$' + IntToStr(Value);
Result := InToStr(StrToInt(s));
end;
(2)方法2
Funtion HexToDec( const Value :Integer) : string;
CONST HEX : ARRAY['A'..'F'] OF INTEGER =
(10,11,12,13,14,15);
VAR
str : String;
In : Integer;
i : integer;
BEGIN
Str := UpperCase(IntToStr(Value));
Int := 0;
FOR i := 1 TO Length(str) DO
IF str[i] < 'A' THEN
Int := Int * 16 + ORD(str[i]) - 48
ELSE
Int := Int * 16 + HEX[str[i]];
Result := IntToStr(Int);
end;