StringIsInt
检查字符串是否为整数.
StringIsInt ( "string" )
参数
返回值
成功:
|
返回 1.
|
失败:
|
返回 0, 字符串不是整数.
|
备注
StringIsInt 对于非字符串整数表达式也返回 1; 但对于类似 "4ff0" 的十六进制表现形式则返回 0.
唯一允许字符串的开头字符是加号或减号.
函数示例
#include <MsgBoxConstants.au3>
MsgBox($MB_SYSTEMMODAL, "", "Is the string +42 an integer: " & StringIsInt("+42") & @CRLF & _ ; Returns 1, due to the + (plus) symbol being at the beginning of the string.
"Is the string -00 an integer: " & StringIsInt("-00") & @CRLF & _ ; Returns 1, due to the - (minus) symbol being at the beginning of the string.
"Is the string 1.0 an integer: " & StringIsInt("1.0") & @CRLF & _ ; Returns 0, due to the decimal point.
"Is the number 1.0 an integer: " & StringIsInt(1.0) & @CRLF & _ ; Returns 1, due to the number to string conversion.
"Is the string 1+2 an integer: " & StringIsInt("1+2") & @CRLF) ; Returns 0, as the + (plus) symbol is not at the beginning of the string.
----------------------------------------
该函数可以通过命令 exect 调用
参见:
StringIsFloat, StringIsDigit, IsInt
StringIsInt('+42') ;; 返回1
StringIsInt('-00') ;; 返回1
StringIsInt('1.0') ;; 由于十进制数字返回0
StringIsInt(1.0) ;; 由于将数字转换为字符串,因此返回1
StringIsInt('1+2') ;; 由于加号返回0
exect=$var_is=StringIsInt('1.5')||$var_bb=StringIsInt('2') GLOBALEXECT<a> ;; 检查字符串是否为整数
© Аверин Андрей для Total Commander Image Averin-And@yandex.ru
|