Hex2Dec

Use this function to return the integer equivalent of a hexadecimal string.

Syntax

Hex2Dec (Value1)

Parameter

Description

Value1

This parameter specifies a string of characters you want converted into an integer value. If the string value does not represent a valid hexadecimal number, the results are questionable and can result in only part of the value being converted.

The largest hexadecimal value supported is FFFFFFFF. Keep in mind, however, that hexadecimal values are considered unsigned while integer values can be both positive and negative.

The largest integer value 2,147,483,647 is 7FFFFFFF when represented using hexadecimal. HEX values greater than 80000000 represent negative integer values. Hex value FFFFFFFF represents the integer value -1.

Example

Here is an example:

y = "1A2B"

z = Hex2Dec(y)

Result is z = 6699

 

y = "FF00"

z = Hex2Dec(y)

Result is z = 65280

See also