Re: Hex2Int handler
Re: Hex2Int handler
- Subject: Re: Hex2Int handler
- From: "Arthur J Knapp" <email@hidden>
- Date: Sat, 07 Apr 2001 19:23:48 -0400
I have recently discovered that a handler I recently posted to this
list had a very serious mistake in it, (that no one noticed,
interestingly enough). Here is an update:
property sHexParse : "0.1.2.3.4.5.6.7.8.9AaBbCcDdEeFf"
on Hex2Int(hexString)
-- hexString == [0-9A-Fa-f]+
set hexString to hexString's items's reverse
set {int, pow} to {0, 0}
repeat with char in (hexString)
set int to int + (((offset of char in sHexParse) div 2) * (16 ^ pow))
set pow to pow + 1
end repeat
return int
end Hex2Int
Arthur J. Knapp
http://www.stellarvisions.com
mailto:email@hidden
Hey, check out:
http://www.mainevent.com