Question Kryštof Matějka · Jul 22, 2016

Hex to dec

Hello, has Cache built-in function for converting hexadecimal number to decimal? 

Comments

Dmitry Maslennikov · Jul 22, 2016

$zhex
hex to dec

write $zhex("99")
​153

and back, dec to hex

write $zhex(153)
​99

be careful, hexadecimal should be a string and decimal should be a number

0
Michael Braam · Jul 22, 2016

You have a couple of choices.

Either use the built in function $zhex or %SYSTEM.Utils.HexToDecimal or %SYSTEM.Utils.DecimalToHex.

See the documentation for details

Hope this helps.

0
Richard Rael · Jul 22, 2016

You can also use %XD and %DX if you want something that prompts:

USER>d ^%XD
 
Hex: FFF        Decimal: 4095
Hex:
 
USER>d ^%DX
 
Decimal: 1240       Hex: 4D8
Decimal:
 

0