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:
    Default = string is interpreted as an integer. 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 <MsgBoxConstants.au3>

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