The X2D function returns a decimal value which corresponds to the given sequence of hexadecimal digits. The values that are returned may be unprintable. When displayed on a console some character values may have surprising effects.
result = X2D( hexadecimalString [, n ] ) |
If hexadecimalString is the empty string, 0 is returned.
When n is unspecified, the hexadecimalString is considered to be an unsigned value.
If n is 0, 0 is returned.
Examples:
say X2D( 'C' ) -- shows: 12 say X2D( 'C3' ) -- shows: 195 say X2D( '007' ) -- shows: 7 say X2D( '2 2BAD' ) -- shows: 142253 say X2D( '81', 2 ) -- shows: -127 say X2D( '81', 4 ) -- shows: 129 say X2D( 'F081', 4 ) -- shows: -3967 say X2D( 'F081', 3 ) -- shows: 129 say X2D( 'F081', 2 ) -- shows: -127 |