HEXVAL

Top  Previous  Next

Action

Convert string representing a hexadecimal number into a numeric variable.

 

 

Syntax

var = HEXVAL( x )

 

 

Remarks

var

The numeric variable that must be assigned.

X

The hexadecimal string that must be converted.

var :  Byte, Integer, Word, Long.

x :  String.

 

The string that must be converted must have a length of 2 bytes ,4 bytes or 8 bytes, for bytes, integers/words and longs respectively.

 

Difference with QB

In QB you can use the VAL() function to convert hexadecimal strings.

But since that would require an extra test for the leading &H signs, that are required in QB, a separate function was designed.

 

 

See also

HEX , VAL , STR

 

 

Example

Dim A As Integer , S As String * 15

S = "000A"

A = Hexval(s) : Print A                   '10

End