|
-
May 22nd, 2000, 10:37 PM
#1
Thread Starter
Lively Member
Can anyone tell me if there is an inverse function to the Hex() function (one that converts hexadecimal back to decimal. Thanks.
Jay D Zimmerman
-
May 22nd, 2000, 10:46 PM
#2
Fanatic Member
Give this a whirl
Just use &H?, where ? is the hexadecimal number.
Code:
MsgBox &H100
'displays 256
[Edited by Iain17 on 05-23-2000 at 04:46 PM]
Iain, thats with an i by the way!
-
May 23rd, 2000, 01:12 AM
#3
Thread Starter
Lively Member
How can I use this function in coordination with a variable?
-
May 23rd, 2000, 03:29 AM
#4
transcendental analytic
'Theres probably only one way strings containing hex can be converted to decimal
Code:
Function unhex(hex)
a = Left(hex, 1)
If a >= "A" Then a = Asc(a) - 55
B = Right(hex, 1)
If B >= "A" Then B = Asc(B) - 55
unhex = Chr(a * 16 + B)
End Function
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
May 23rd, 2000, 03:36 AM
#5
Hyperactive Member
it's easier than that... just do this since we know a HEX result is a string
Code:
'' assumes HEX value has no id prefex ie 0x or &H
Public Function HEX2DEC(ByRef hex_str As String) as Long
HEX2DEC = CLng("&H" & hex_str)
End Function
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|