--Based on scripts by Kevan Dettelbach and Chuck Neal
--Convert a String into an integer,
--for hex-to-int call convToInt(szConv, 16)
--for bit-to-int call convToInt(szConv, 2) .....
--no complete errorchecking: convToInt("2EF", 2) works, but makes no sense ;-)
on ConvToInt szConvNum, nBase
if nBase > 1 and nBase < 17 then
baseNums = ["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"]
nConverted = 0
nMax = szConvNum.length
repeat with nIndex = 1 to nMax
nConverted = nConverted * nBase
nConverted = nConverted + baseNums.getOne(szConvNum.char[nIndex]) - 1
end repeat
return nConverted
else
return VOID
end if
end
Contact
MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA