Oxygen Basic

Programming => Problems & Solutions => Topic started by: chrisc on March 20, 2018, 07:57:51 PM

Title: Converting from Hex to numbers
Post by: chrisc on March 20, 2018, 07:57:51 PM
in PB we use the VAL function to convert Hex to numbers as below

Code: [Select]
local tempnum as Long
 tempnum = VAL("&H" +"5E65A486")


 do you have an equivalent function in O2?
Title: Re: Converting from Hex to numbers
Post by: Charles Pegge on March 20, 2018, 09:37:28 PM
Yes, we also have val, but o2 will convert strings to numbers and vice-versa automatically.

Code: [Select]
local tempnum as Long
tempnum = VAL("&H" +"5E65A486")
tempnum = VAL("0x" +"5E65A486")
tempnum = "0x"+"5E65A486"
tempnum = "&h5E65A486"
Title: Re: Converting from Hex to numbers
Post by: chrisc on March 21, 2018, 04:18:20 AM
Thanxx Charles, this is a beauty