[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> I've been trying to decipher some formulae I found online which
> convert hex to decimal numbers, with a view to re-writing it in
> lingo, but my head is hurting already.
Hi Chris,
You'll find below the fastest 32-bit conversion handlers that I am
put xHexToDec("F31AA9")
-- 15932073
But no limit version:
on xHexToDec(sHex)
sHex = (sHex.string)
nLength = sHex.char.count
sNum = sHex.char[nLength]
nNum = offset(sNum, "0123456789ABCDEF") - 1
if nLength <= 1 then
return nNum
else
return nNum + xHexToDec(sHex.char[1..(nLength
Well, you can do small chunks of numbers by co-opting the rgb function, as in:
put rgb("A9")
-- rgb( 0, 0, 169 )
The problem is that when you go over one byte, then you get each byte
individually, and of course, it doesn't go over three bytes total
put rgb("F31AA9")
-- rgb( 243, 2
Memo from Chris Couldridge of PricewaterhouseCoopers
Start of message text
Well I ended up working it out for myself...
on hexToDec hexNumber
hexToDecList = ["0":0, "1":1, "2":2, "3":3, "4":4, "5":5, "6":6, "7":7,
"8":8, "9":9, "A":10, "B":11, "C":12
Memo from Chris Couldridge of PricewaterhouseCoopers
Start of message text
Not being very maths-oriented, I've been trying to decipher some formulae I
found online which convert hex to decimal numbers, with a view to
re-writing it in lingo, but my head