BitXtoD


The BitXtoD function converts a hexadecimal string to a decimal number.

Syntax

nNumber = BitXtoD( sHex )

    nNumber is a decimal number.

    sHex is a hexadecimal string representation of a number.

  

The hexadecimal string representation has the lowest-order bit at the right end of the string. The function does not care whether the string contains leading zeros for the highest order bits that are not set.

Example

The following script converts a hexadecimal string representation to a decimal number. Note that the decimal number is printed using %u because it is considered an unsigned (i.e., 0 or positive) integer.

sHex = "25"

-- pick a hexadecimal number

n = BitXtoD( sHex )

-- convert to a number

Printf( "'%s hex --> %u decimal", sHex, n )

-- prints 25 hex --> 37 decimal

Related Topics

Boolean Math Functions

BitDtoX

BitXtoB