Function Reference


Hex

Returns a string representation of an integer or of a binary type converted to hexadecimal.

Hex ( expression [, length] )

Parameters

expression The expression to convert.
length [optional] Number of characters to be returned for integer.
Characters are truncated from the left-hand side if length is too small.
This parameter is ignored if the data is binary data.

Return Value

Success: Returns a string of length (never more than 16) characters, zero-padded if necessary for integer.
Returns the binary type converted.
Special: Returns "" (blank string) if length is less than 1.

Remarks

Omitting the second parameter (length) or using the keyword Default results in automatic sizing of the output; 8-characters display for numbers that can fit in that and 16-characters display for others.
A pointer type parameter is displayed in size of pointer by default (8 characters for x86 and 16 characers for x64).
64bit integers have 16 characters displayed by default.
Numbers passed as non-integers (those with decimal separator or exponent) are processed as doubles.

Related

Dec, BitAND, BitNOT, BitOR, BitRotate, BitShift, BitXOR

Example


Local $result = Hex(1033, 4) ;returns "0409"