procedure TForm1.Button1Click(Sender: TObject); var str:string; res:integer; i:integer; begin res:=0; str:=trim(edit1.Text); for i:=0 to length(str) do begin case str[i] of 'a':res:=res+10; 'b':res:=res+11; 'c':res:=res+12; 'd':res:=res+13; 'e':res:=res+14; 'f':res:=res+15; end; if str[i] in ['0'..'9'] then res:=res+strtoint(str[i]); if i<length(str)then res:=res*16; end; showmessage(inttostr(res));end;
http://community.csdn.net/Expert/topic/4079/4079408.xml?temp=.4114801
StrToInt('$'+HexString)的http://lysoft.7u7.net
var str:string;
res:integer;
i:integer;
begin
res:=0;
str:=trim(edit1.Text);
for i:=0 to length(str) do
begin
case str[i] of
'a':res:=res+10;
'b':res:=res+11;
'c':res:=res+12;
'd':res:=res+13;
'e':res:=res+14;
'f':res:=res+15;
end;
if str[i] in ['0'..'9'] then
res:=res+strtoint(str[i]);
if i<length(str)then res:=res*16;
end;
showmessage(inttostr(res));end;