Hex

From AutoIt Wiki

Jump to: navigation, search

Returns a string representation of an integer or of a binary type converted to hexadecimal. Adapted from AutoIt docs.

Contents

Syntax

$var = Hex(expr [, length])

Parameters

exprThe expression to convert. 32-bit signed integer (-2147483648 to 2147483647).
lengthNumber of characters to be returned (up to 8) for integer. Characters are truncated from the left-hand side if length is too small. On binary types the whole length is converted.(Optional)

Return Value

Success: Returns a string of length characters, zero-padded if necessary for integer. Returns the binary type converted.
Special: Returns an empty string if length is less than 1.
Failure: Returns an empty string and sets @error to 1 if length is greater than 8.

@error will also be set to 1 if length is too small to fit the full result in which chase the returned string will be the least significant digits.

Example

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

Related Functions

Dec

Personal tools