Hex()

Syntax

Result$ = Hex(Value.q [, Type])
Description
Converts a quad numeric number into a string, in hexadecimal format.

Parameters

Value.q The number to convert.
Type (optional) If the value should be handled as another type, one of the following value can be specified:
  #PB_Quad   : The value is handled as a quad number, ranging from 0 to 18446744073709551615 (default)
  #PB_Byte   : The value is handled as a byte number, ranging from 0 to 255
  #PB_Ascii  : The value is handled as a ascii character, ranging from 0 to 255
  #PB_Word   : The value is handled as a word number, ranging from 0 to 65535
  #PB_Unicode: The value is handled as a unicode character, ranging from 0 to 65535
  #PB_Long   : The value is handled as a long number, ranging from 0 to 4294967296

Return value

A string holding the hexadecimal representation of the specified value.

Example

  Debug Hex(12) ; Will display "C"
  Debug Hex(1234567890) ; Will display "499602D2"

Remarks

If leading zero are needed in the output string, use the RSet() function as follows:
  Debug RSet(Hex(12), 4, "0") ; Will display "000C"

Example

  Debug Hex(-1)
  Debug Hex(-1, #PB_Byte)
  Debug Hex(-1, #PB_Word)
  Debug Hex(-1, #PB_Long)
  Debug Hex(-1, #PB_Quad)    ; quad value is the default

See Also

Str(), Val(), Bin()

Supported OS

All

<- FormatNumber() - String Index - InsertString() ->