procedure TForm1.Button1Click(Sender: TObject);
Const HEX : ARRAY['A'..'F'] OF INTEGER = (10,11,12,13,14,15);
var
str : String;
Int, i: integer;
begin
STR:=EDIT1.TEXT;
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]];
Edit1.Text:=IntToStr(Int);
end;