HexVal()

Converts a string with hex notation to a unsigned integer. The conversion routine knows the notation literals 0x and &h and the conversion is not case-sensitive. First invisible chars (ASCII 0-32) are ignored/skipped.

The result is unsigned 32 Bit integer (long/uint32), but if you assign this value to a signed 32 bit datatype such as longin or int32, the value will become signed.

Syntax: long = HexVal(text as string)

Example

  dim result as long
  dim s as string
  result = HexVal("0xa")
  result = HexVal("0xab12")
  result = HexVal("&hab12")
  result = HexVal("0xabcd1234")
  s = "1a2c"
  result = HexVal("0x"+s)