HEX( ) function

Converts an ASCII string to a hexadecimal string.

Syntax

HEX(field)

Parameters

Name Type Description
field character The ASCII string to convert to a hexadecimal string.

Output

Character.

Examples

Basic examples

Returns "3132333435":

HEX("12345")

Returns the values in the Count field as hexadecimal strings:

HEX(Count)

Remarks

How it works

This function returns the hexadecimal string that is equivalent to the field value or expression you specify. You can use the function when you need to identify the exact contents of a field, including characters that cannot be displayed on screen, such as CR (carriage return), LF (line feed), and NUL (null).

Return value length

The return value is a string that is double the length of the field value. The digits 0 to 9 and the letters A to F (for the digits 10 to 15) represent the 16 hexadecimal values.

Use fields as input rather than expressions

In general, you should apply this function to fields rather than expressions because it displays a representation of the internal storage format of expressions, which is not meaningful in most instances.