How to convert Hex to Int?

I have hex strings '00001A7000000000' ... '00001A700000012D'
how to convert each of them to unique integer
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
You should try :

function hexaToInt(s : string) : Int64;
begin
if (s <> '') and (s[1] <> '\$') then
result := strToInt64('\$' + s)
else
result := strToInt64(s);
end;

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Commented:
Try this one:

function HexToInt2(s: string): Int64;
var
b: Byte;
c: Char;
begin
Result := 0;
s := UpperCase(s);
for b := 1 to Length(s) do
begin
Result := Result * 16;
c := s[b];
case c of
'0'..'9': Inc(Result, Ord(c) - Ord('0'));
'A'..'F': Inc(Result, Ord(c) - Ord('A') + 10);
else
raise EConvertError.Create('No Hex-Number');
end;
end;
end;
Commented:
What is the point of recoding a function that is in the VCL ?
Commented:
Where in the VCL?
It was taken from torry's site.
And that is an alternative solution.
Commented:
The function is StrToInt64, available in the SysUtils unit. You just have to prefix the string by \$ pr 0x to tell this function the string you pass is hexa...
Ok for the alternative solution, but IMHO, when something is already available, you should bother recoding your own, except for a very good reason...
Commented:
I think, we should let the Author decide what solution suites his needs better. BTW, your solution will work only in Delphi, while the logic that I posted (with minor changes) will work in other programming languages (and that is the good reason).
Commented:
Right, he should decide.

However, we are in the Delphi section, not in the Programming one, so I suspects that he wants a Delphi solution ;)
Commented:
agree with Greybird .. although there is one small caveat .. the letters must be lowercase :)
Author Commented:
if i use:

function hexaToInt(s : string) : Int64;
begin
if (s <> '') and (s[1] <> '\$') then
result := strToInt64('\$' + s)
else
result := strToInt64(s);
end;

How to convert this integer back to HexString?

e.g. 00001A7000000000 = 29068338659328
29068338659328 = 00001A7000000000
Commented:
use Format('%x', [29068338659328])
Author Commented:
if i use format i get: 1A7000000000
Commented:
In fact you should use :
Format('%.16x', [29068338659328])