Teya Salat
/ /

XtScript Function: dechex and hexdec

Converts decimal numbers to hexadecimal, or hexadecimal numbers to decimal.

XtScript dechex is a function to convert numbers (decimal) to hex format.

Otherwise, a string written in hex format can be decoded to numbers (decimal) using XtScript hexdec function.

XtScript dechex and hexdex function basic syntax:

<!--parser:xtscript-->
	# Encode decimal numbers to hex format
	call dechex $val=...

	# Decode a string in hex format to decimal numbers
	call hexdec $val=...
<!--/parser:xtscript-->

Learn XtScript dechex and hexdec function from examples

Encode decimal numbers to hex format using dechex.

- Code:
<!--parser:xtscript-->
	var $number = 14121994
	var $encoded = call dechex $val=$number

	print Number: $number <br/>
	print Encoded: $encoded
<!--/parser:xtscript-->
- Result:
Number: 14121994
Encoded: d77c0a

Decode string in hex format to decimal numbers using hexdec function.

- Code:
<!--parser:xtscript-->
	var $hex = 00FF05
	var $number = call hexdec $val=$hex

	print Hex: $hex <br/>
	print Decimal: $number
<!--/parser:xtscript-->
- Result:
Hex: 00FF05
Decimal: 65285