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: a string of length (never more than 16) characters, zero-padded if necessary for integer. Returns the binary type converted.
Special: "" (empty 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 characters 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

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

Example

#include <MsgBoxConstants.au3>

; Assign a Local variable the hex number representation of 1033.
Local $sHex1 = Hex(1033, 4)

; Display the result.
MsgBox($MB_SYSTEMMODAL, "", $sHex1)