Converts hexadecimal strings into decimals
Function Hex2Dec(strHex)
dim lngResult, intIndex, strDigit, intDigit, intValue
lngResult = 0
For intIndex = len(strHex) to 1 step -1
strDigit = mid(strHex, intIndex, 1)
intDigit = instr("0123456789ABCDEF", ucase(strDigit))-1
If intDigit >= 0 then
intValue = intDigit * (16 ^ (len(strHex)-intIndex))
lngResult = lngResult + intValue
Else
lngResult = 0
intIndex = 0 ' stop the loop
End if
Next
Hex2Dec = lngResult
End Function
dim lngResult, intIndex, strDigit, intDigit, intValue
lngResult = 0
For intIndex = len(strHex) to 1 step -1
strDigit = mid(strHex, intIndex, 1)
intDigit = instr("0123456789ABCDEF", ucase(strDigit))-1
If intDigit >= 0 then
intValue = intDigit * (16 ^ (len(strHex)-intIndex))
lngResult = lngResult + intValue
Else
lngResult = 0
intIndex = 0 ' stop the loop
End if
Next
Hex2Dec = lngResult
End Function
strHex
Views 3,897
Downloads 1,297
CodeID
DB ID