Hexadecimal to decimal

后端 未结 1 1722
清酒与你
清酒与你 2020-12-12 04:26

I have to convert a hexadecimal number to decimal, but don\'t know how. In the AutoIt documentation (pictured below) some constants (being assigned hexadecimal values) are d

相关标签:
1条回答
  • 2020-12-12 04:46

    As per Documentation - Language Reference - Datatypes:

    In AutoIt there is only one datatype called a Variant. A variant can contain numeric or string data and decides how to use the data depending on the situation it is being used in.

    Issuing:

    ConsoleWrite(0x00200000 & @LF)
    

    demonstrates stated behavior. Use Int() in case of conversion requirement:

    #region Hex2Dec
    Global Const $dBin1 = 0x00200000
    Global Const $iInt1 = Int($dBin1)
    
    ConsoleWrite($iInt1 & @LF)
    #endregion
    
    #region Dec2Hex
    Global Const $iInt2 = 8192
    Global Const $dBin2 = Hex($iInt2)
    
    ConsoleWrite('0x' & $dBin2 & @LF)
    #endregion
    

    Related functions include:

    • Int()
    • Number()
    • String()
    • StringToBinary()
    • StringToASCIIArray()
    • StringFromASCIIArray()
    • Binary()
    • BinaryToString()
    • Ptr()
    • HWnd()
    0 讨论(0)
提交回复
热议问题