十六进制转十进制

Hexadecimal to decimal

我必须将十六进制数转换为十进制数,但不知道如何操作。在 AutoIt 文档中(如下图所示)定义了一些常量(分配了十六进制值):

0x00200000 十六进制(图中有下划线)等于 8192 十进制(这是真正的转换)。但是转换器 return 2097152。我必须转换另一个十六进制值 (0x00000200),但转换器弄错了。如何正确转换?

当我使用定义 $WS_EX_CLIENTEDGE(或十六进制值)时,它不起作用。如果我使用整数,我相信它会起作用。

根据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.

发行:

ConsoleWrite(0x00200000 & @LF)

表现出规定的行为。在转换要求的情况下使用Int()

#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

相关函数包括: