Visual Basic Scripting Edition | 語言參考 |
返回表示十六進(jìn)制數(shù)字值的字符串。
Hex(number)
number 參數(shù)是任意有效的表達(dá)式。
如果 number 參數(shù)不是整數(shù),則在進(jìn)行運算前將其四舍五入為最接近的整數(shù)。
如果 number 是 | Hex 返回 |
---|---|
Null | Null。 |
Empty | 零 (0)。 |
其他數(shù) | 最大到八位的十六進(jìn)制字符。 |
您可以通過在數(shù)字前面添加前綴 &H 來表示十六進(jìn)制數(shù)。例如,在十六進(jìn)制計數(shù)法中,&H10 表示十進(jìn)制數(shù) 16。
下面的示例利用 Hex 函數(shù)返回數(shù)字的十六進(jìn)制數(shù):
Dim MyHex MyHex = Hex(5)
'
返回5
。MyHex = Hex(10)
'
返回A
。MyHex = Hex(459)
'
返回1CB
。