{HexToCard:
将一个十六进制的串转化为一个Cardinal
}
function HexToCard(sHex:string):Cardinal;
var
iLen:Integer;
it:Integer;
by:Byte;
begin
if AnsiContainsText(sHex,'0x') then
sHex:=Copy(sHex,3,8);
Result:=0;
iLen:=Length(sHex);
for it:=1 to iLendo
begin
Result := Result shl 4;
by:=Byte(sHex[it]);
case by of
ASCII_0..ASCII_0+9: Inc(Result,by-ASCII_0);
ASCII_CA..ASCII_CA+5 : Inc(Result,by-ASCII_CA+10);
ASCII_A..ASCII_A+5 : Inc(Result,by-ASCII_A+10);
else
Raise Exception.Create(Format(rsErrorParam,[]));
end;
end;
end;