function HexToDec(Hexa:string):integer; const ValoresHexa:array['A'..'F'] of integer=(10,11,12,13,14,15); var nDecimal:integer; nIndex:byte; begin nDecimal:=0; Hexa:= Uppercase(Hexa); for nIndex:=length(Hexa) downTo 1 do if Hexa[nIndex] in ['0'..'9'] then nDecimal:=nDecimal+StrToInt(Hexa[nIndex])* Trunc(Exp(Length(Hexa)-nIndex)*ln(16))) else nDecimal:=nDecimal+ValoresHexa[Hexa[nIndex]]* Trunc(Exp(Length(Hexa)-nIndex)*ln(16))); result:=nDecimal; end;
const
ValoresHexa:array['A'..'F'] of integer=(10,11,12,13,14,15);
var
nDecimal:integer;
nIndex:byte;
begin
nDecimal:=0;
Hexa:= Uppercase(Hexa);
for nIndex:=length(Hexa) downTo 1 do
if Hexa[nIndex] in ['0'..'9'] then
nDecimal:=nDecimal+StrToInt(Hexa[nIndex])*
Trunc(Exp(Length(Hexa)-nIndex)*ln(16)))
else
nDecimal:=nDecimal+ValoresHexa[Hexa[nIndex]]*
Trunc(Exp(Length(Hexa)-nIndex)*ln(16)));
result:=nDecimal;
end;