HEX TO DEZ ???
Author Message HEX TO DEZ ???

Can Anyone tell how to convert hexadezimal values  to dezimal ones?

I tried something like

a\$ = "FF"
b%= &H(a\$)
...
but it didn`t work!

Tue, 08 Jul 1997 16:14:36 GMT  HEX TO DEZ ???

Quote:

> Can Anyone tell how to convert hexadezimal values  to dezimal ones?

> I tried something like

> a\$ = "FF"
> b%= &H(a\$)
> ....
> but it didn`t work!

Try something like...

b% = VAL("&H" + a\$)

See the help entry on VAL for details.

JA

Wed, 09 Jul 1997 08:17:07 GMT  HEX TO DEZ ???
: Can Anyone tell how to convert hexadezimal values  to dezimal ones?

: I tried something like

: a\$ = "FF"
: b%= &H(a\$)

Function H(Hex_Number as String) as Integer
Dim Index as Integer

Decimal_Number=0
for Index=1 to Len(Hex_Number)
Select Case UpCase\$(Mid\$(Hex_Number,Index,1))
Case "0": Hex_Equivalent=0
Case "1": Hex_Equivalent=1
Case "2": Hex_Equivalent=2
Case "3": Hex_Equivalent=3
Case "4": Hex_Equivalent=4
Case "5": Hex_Equivalent=5
Case "6": Hex_Equivalent=6
Case "7": Hex_Equivalent=7
Case "8": Hex_Equivalent=8
Case "9": Hex_Equivalent=9
Case "A": Hex_Equivalent=10
Case "B": Hex_Equivalent=11
Case "C": Hex_Equivalent=12
Case "D": Hex_Equivalent=13
Case "E": Hex_Equivalent=14
Case "F": Hex_Equivalent=15
End Select
Decimal_Number=Decimal_Number*16+Hex_Equivalent
Next

What this does is say the string was "1e4f2"
then you would get: (((((0*16+1)*16+14)*16+4)*16+15)*16+2 = 124146

Jerry

: ...
: but it didn`t work!

Wed, 09 Jul 1997 17:08:39 GMT  HEX TO DEZ ???
: Can Anyone tell how to convert hexadezimal values  to dezimal ones?

: I tried something like

: a\$ = "FF"
: b%= &H(a\$)
: ...
: but it didn`t work!

Try b% = Val("&H"+a\$)

Wed, 09 Jul 1997 08:51:15 GMT  HEX TO DEZ ???

Quote:

>: Can Anyone tell how to convert hexadezimal values  to dezimal ones?

>: I tried something like

>: a\$ = "FF"
>: b%= &H(a\$)

try b% = val("&H" & a\$)

rgds
djw
-----------------------------------------------------------------------------

-----------------------------------------------------------------------------
The transient and the eternal are the same.    (G.R.{*filter*}son)
-----------------------------------------------------------------------------

Fri, 18 Jul 1997 17:53:22 GMT  HEX TO DEZ ???

Quote:

>: Can Anyone tell how to convert hexadezimal values  to dezimal ones?

>: I tried something like

>: a\$ = "FF"
>: b%= &H(a\$)

[...snip...]

Try b% = val("&H" & a\$)
or  b% = val("&HFF")

rgds
djw
-----------------------------------------------------------------------------

-----------------------------------------------------------------------------
The transient and the eternal are the same.    (G.R.{*filter*}son)
-----------------------------------------------------------------------------

Fri, 18 Jul 1997 18:13:19 GMT  HEX TO DEZ ???
Hi,

Quote:
>: Can Anyone tell how to convert hexadezimal values  to dezimal ones?

>: I tried something like

>: a\$ = "FF"
>: b%= &H(a\$)

> try b% = val("&H" & a\$)

I would simply say :

iValue = &HFF

We are talking about an integer (or long) value here. There is no
difference between the decimal or the hexadecimal notation.

Bye, Jan

Jan G.P. Sijm
Fidonet  : 2:280/410.14

Sun, 20 Jul 1997 04:52:49 GMT

 Page 1 of 1 [ 7 post ]

Relevant Pages