返回某表达式的数值结果.
Number ( 表达式 [, 标志 ] )
表达式 | 要转换成数字的一个表达式. |
标志 | [可选参数] Defines behavior. Can be one of the following: Default = the result is auto-sized integer. See remarks. 1 = the result is 32bit integer. 2 = the result is 64bit integer. 3 = the result is double. |
Local $iNumber1 = Number(1 + 2 + 10) ; Returns 13.
Local $iNumber2 = Number("3.14") ; Returns 3.14.
Local $iNumber3 = Number("24/7") ; Returns 24.
Local $iNumber4 = Number("tmp3") ; Returns 0 as this is a string.
Local $iNumber5 = Number("1,000,000") ; Returns 1 as it strips everything after the first comma.
MsgBox(4096, "", "The following values were converted to a numeric value:" & @CRLF & _
$iNumber1 & @CRLF & $iNumber2 & @CRLF & $iNumber3 & @CRLF & $iNumber4 & @CRLF & $iNumber5)