Converts a hex-string to an integer
Converts a hex-string to an integer
API Declarations
Dim a, c, d As Integer
Rate Converts a hex-string to an integer
(2(2 Vote))
'We'll start by getting every character out of the
'hex-string seperatly
For a = 1 To Len(hexx)
b = Mid$(hexx, a, 1)
'Then we'll change the hex-strings "A" to "F" by "10" to "15"
If ucase(b) = "A" Then b = "10"
If ucase(b) = "B" Then b = "11"
If ucase(b) = "C" Then b = "12"
If ucase(b) = "D" Then b = "13"
If ucase(b) = "E" Then b = "14"
If ucase(b) = "F" Then b = "15"
'and put the integer value in c
c = Val(b)
'this line converts every character from the hex-string to
'an integer value, and counts them together
d = d + (c * (16 ^ (Len(hexx) - a)))
Next a
hex_to_int = d 'assign the function to d
End Function
Converts a hex-string to an integer Comments
No comments yet — be the first to post one!
Post a Comment