StringIsDigit
检查字符串是否仅包含数字(0-9)字符.
StringIsDigit ( "string" )
参数
返回值
成功:
|
返回 1.
|
失败:
|
返回 0, 字符串含有非数字字符.
|
备注
见示例.
函数示例
#include <MsgBoxConstants.au3>
MsgBox($MB_SYSTEMMODAL, "", "Is the string 42 a digit: " & StringIsDigit("42") & @CRLF & _ ; Returns 1, as the string contains only digit (0-9) characters.
"Is the string 00 a digit: " & StringIsDigit("00") & @CRLF & _ ; Returns 1, as the string contains only digit (0-9) characters.
"Is the string 1.0 a digit: " & StringIsDigit("1.0") & @CRLF & _ ; Returns 0, due to the decimal point.
"Is the number 1.0 a digit: " & StringIsDigit(1.0) & @CRLF & _ ; Returns 1, due to the number to string conversion.
"Is the string 1+2 a digit: " & StringIsDigit("1+2") & @CRLF) ; Returns 0, as the + (plus) symbol is present in the string.
----------------------------------------
该函数可以通过命令 exect 调用
参见:
StringIsXDigit, StringIsFloat, StringIsInt, StringIsAlNum, StringIsASCII
StringIsDigit('12333') ; 返回1
StringIsDigit('1.5') ; 由于十进制数字返回0
StringIsDigit('1~~2~~3') ; 为空格返回0
StringIsDigit('') ; 返回0
exect=$var_is=StringIsDigit('12333')||$var_bb=StringIsDigit('1.2') GLOBALEXECT<a> ;; 检查字符串中只有数字的存在(0-9)
© Аверин Андрей для Total Commander Image Averin-And@yandex.ru
|