&HEX-AS-NUMBER

Convert a text string containing hexadecimal characters to an unsigned numeric value.
Restriction: This topic applies only when the AppMaster Builder AddPack has been installed, and applies only to Windows platforms.

Syntax:

&HEX-AS-NUMBER
  (&variablename)

Aliases:

&hex-as-number (&variablename) &Hex-As-Number(&variablename)
&hexasnumber (&variablename)   &HexAsNumber (&variablename)
&HEXASNUMBER (&variablename)

&HEX-AS-UNSIGNED (&variablename)&hex-as-unsigned (&variablename)
&Hex-As-Unsigned (&variablename)&HEXASUNSIGNED (&variablename)
&hexasunsigned (&variablename) &HexAsUnsigned (&variablename)

Comments:

  • The generator converts hex strings to their unsigned equivalent. Exception A sequence of eight hex characters can be converted to a signed number because the generator deals with signed fullwords. Because the numeric type is always signed, the generator converts hex values greater than 7FFFFFFF to the signed value (a negative value) and issues a warning message.
  • The string being converted should:
    • Contain hexadecimal values.
    • Not be empty.
    • Have string symbol type of text.

Example:

&HEX-AS-NUMBER ("00")  = 0
&HEX-AS-NUMBER ("01")  = 1
&HEX-AS-NUMBER ("0A")  = 10
&HEX-AS-NUMBER ("0F")  = 15
&HEX-AS-NUMBER ("10")  = 16
&HEX-AS-NUMBER ("13")  = 19
&HEX-AS-NUMBER ("6F")  = 111
&HEX-AS-NUMBER ("7F")  = 127
&HEX-AS-NUMBER ("FF")  = 255
&HEX-AS-NUMBER ("F")   = 15
&HEX-AS-NUMBER ("1000")  = 4096
&HEX-AS-NUMBER ("4142")  = 16962
&HEX-AS-NUMBER ("6FFF")  = 28671
&HEX-AS-NUMBER ("7000")  = 28672
&HEX-AS-NUMBER ("7FFF")  = 32767
&HEX-AS-NUMBER ("FFFF")  = 65535
&HEX-AS-NUMBER ("FFFFF")  = 1048575
&HEX-AS-NUMBER ("100000")    = 1048576
&HEX-AS-NUMBER ("10000000")  = 268435456
&HEX-AS-NUMBER ("7FFFFFFF")  = 2147483647