Reputation: 711
I have a hexadecimal string value. I want to convert it to an integer.
function HexStrToInt(const str: string): Integer;
begin
Result := ??;
end;
such that HexStrToInt('22')
, for example, returns 34
.
Upvotes: 8
Views: 21536
Reputation: 613582
Perhaps the simplest is to do this:
function HexStrToInt(const str: string): Integer;
begin
Result := StrToInt('$' + str);
end;
Upvotes: 30