Hex->Decimal 
Author Message
 Hex->Decimal

Hi all, any ideas what the most efficient way to convert hex->decimal is? I
wrote a routine that used a really shady technique that was about 30 lines
long and I forgot to save it, doh. Now I'm looking for a way to do it
without retyping all that junk. So... any ideas?

Thanks in advance,
Jado.

(www.jado.org)



Sun, 14 Oct 2001 03:00:00 GMT  
 Hex->Decimal
Use the Hex() function.  It's 1 line long.
Quote:

> Hi all, any ideas what the most efficient way to convert hex->decimal is? I
> wrote a routine that used a really shady technique that was about 30 lines
> long and I forgot to save it, doh. Now I'm looking for a way to do it
> without retyping all that junk. So... any ideas?

> Thanks in advance,
> Jado.

> (www.jado.org)



Sun, 14 Oct 2001 03:00:00 GMT  
 Hex->Decimal

Quote:

>Hi all, any ideas what the most efficient way to convert hex->decimal is? I
>wrote a routine that used a really shady technique that was about 30 lines
>long and I forgot to save it, doh. Now I'm looking for a way to do it
>without retyping all that junk. So... any ideas?

Thirty lines long?  How about:

        Dim lValue As Long
        lValue = CLng("&H" & sHexString)

Lee Weiner
weiner AT fuse DOT net
http://home.fuse.net/lweiner



Sun, 14 Oct 2001 03:00:00 GMT  
 Hex->Decimal
Just using Hex() will give you Decimal -> Hex, to go the other way you could
use something like this:

CInt("&H" & Hex(x))    ...  or maybe use CLng depending on what you need.

Probably the best way to do it in VB..

- Erik Schaible
  Centre Analytical Laboratories

Quote:

>Use the Hex() function.  It's 1 line long.


>> Hi all, any ideas what the most efficient way to convert hex->decimal is?
I
>> wrote a routine that used a really shady technique that was about 30
lines
>> long and I forgot to save it, doh. Now I'm looking for a way to do it
>> without retyping all that junk. So... any ideas?

>> Thanks in advance,
>> Jado.

>> (www.jado.org)



Sun, 14 Oct 2001 03:00:00 GMT  
 Hex->Decimal
You dancer, thanks for the help guys, the

lValue = CLng("&H" & sHexString)

works, I'm glad I asked here before I tried rewriting my messy code.

Thanks again.
Jado.



Mon, 15 Oct 2001 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Hex <----> Decimal conversions

2. Hex => Decimal

3. hex string -> hex number

4. HEX >> DEC

5. hex to decimal

6. INPUTing Decimal, PUTting Hex

7. Converting Hex to Decimal

8. Converting Hex to Decimal

9. Hex to Decimal - Urgent

10. Convert HEX to decimal?

11. Convert HEX into Decimals

12. Hex to Decimal Function

 

 
Powered by phpBB® Forum Software