Function Reference


Returns a numeric representation of a hexadecimal string.

Dec ( "hex" [, flag = 0] )


hex The hexadecimal string to convert.
flag [optional] Defines behavior.
Can be one of the following:
    $NUMBER_AUTO (0 ) = string is interpreted as an integer (Default). See remarks.
    $NUMBER_32BIT (1) = string is interpreted as a 32bit integer
    $NUMBER_64BIT (2) = string is interpreted as a 64bit integer
    $NUMBER_DOUBLE (3) = string is interpreted as a double

Constants are defined in "AutoItConstants.au3".

Return Value

Success: the required data.
Failure: 0 and sets the @error flag to 1 if an invalid hex string was used or if an overflow occurs.


Default behavior is that the input string is treated as an integer. In this case, if the result is within range of a 32bit integer then it's returned as a 32bit integer, otherwise it's returned as a 64bit integer - both signed.




#include <AutoItConstants.au3>
#include <MsgBoxConstants.au3>

Func _Example()
        Local $iDec = Dec("FFF", $NUMBER_AUTO)
        MsgBox($MB_SYSTEMMODAL, "", $iDec) ; Displays the number 4095.