[Gambas-user] does exit a instruction to convert hexadecimal to decimal?

Brian G brian at westwoodsvcs.com
Wed Sep 27 22:28:36 CEST 2023


Here is an example of using eval to read hex numbers

Sub readhex() As Integer
Dim hexvalue As String
again:
Print "enter hex number > ";
Flush
Line Input hexvalue
If Not IsHexa(hexvalue) Then
    Print "Bad Hex value"
    Goto again
Endif
Return Eval("&h0" & hexvalue)
End

On 9/27/23 12:29, roberto.premoli at tiscali.it wrote:
> Hello,
> I use hex$ to convert decimal to hexadecimal, and it works
>
> But I ave also the opposite need, to convert a HEXacecimal value into 
> a DECimal value but it seems does not exist a "DEC$"
>
> I can write my own routine that elaborate the string (i.e. "EA") and 
> return the equivalent inter decimal 234, but it will be better to use 
> the gambas instruction, , if it exist.
>
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----

-- 
~~~~ Brian

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0x78BFB26402F48419.asc
Type: application/pgp-keys
Size: 2428 bytes
Desc: OpenPGP public key
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20230927/e30c3e7c/attachment.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 665 bytes
Desc: OpenPGP digital signature
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20230927/e30c3e7c/attachment.sig>


More information about the User mailing list