Hex (Convert to Hexadecimal)

The Hex function returns a hexadecimal string representation of value of type Long. The input is converted to a Long data type before it is converted to hexadecimal.

Syntax

Variable =Hex (Expression)

Remarks

The Hex function returns a variable length string with no leading zeros. The result should be formatted as type String of at least 9 characters. If a fixed length string is required, use the Sprintf function for conversion and formatting.

The input for Hex (Expression parameter) can be a constant, variable, or expression. Expression cannot be of type String. Keep in mind that the input is converted to Long during processing. For example Hex(9.469614E-13) will result in "0" and not "2B8545E1"; 9.469614E-13 will first be converted to 0 (the closet Long representation) and then to hexadecimal. To covert a floating point number to hexadecimal first move the bytes into a Long and then into Hex (refer to earlier Example program).

Parameter

Expression

The expression on which to perform the Decimal to Hex or Hex to Decimal conversion.

Type: String (for HextoDec) or Decimal Value (for Hex)