IsKeyword
检查变量是否为关键字.例如: Default(默认).
IsKeyword ( variable )
参数
返回值
成功:
|
返回 $KEYWORD_DEFAULT (1) 为关键字 Default
返回 $KEYWORD_NULL (2) 为关键字 Null
|
失败:
|
返回 0, 不是关键字
|
常量定义在 AutoItConstants.au3
备注
详细说明参考 语言参考-数据类型.
相关
Default, Null, VarGetType
函数示例
#include <Constants.au3>
#include <MsgBoxConstants.au3>
Example()
Func Example()
; Check if a variable is the Default keyword.
Local $vDefault = Default
If IsDefault($vDefault) Then
MsgBox($MB_SYSTEMMODAL, "", "The variable is the Default keyword")
Else
MsgBox($MB_SYSTEMMODAL, "", "The variable is not the Default keyword")
EndIf
; Check if a variable is the Null keyword.
Local $vNull = Null
If IsNull($vNull) Then
MsgBox($MB_SYSTEMMODAL, "", "The variable is the Null keyword")
Else
MsgBox($MB_SYSTEMMODAL, "", "The variable is not the Null keyword")
EndIf
; Check if a variable is the Null keyword. This will be false as $sString is a string datatype.
Local $sString = 'Default'
If IsDefault($sString) Then
MsgBox($MB_SYSTEMMODAL, "", "The variable is the Default keyword")
Else
MsgBox($MB_SYSTEMMODAL, "", "The variable is not the Default keyword")
EndIf
EndFunc ;==>Example
Func IsDefault($vKeyword)
Return IsKeyword($vKeyword) = $KEYWORD_DEFAULT
EndFunc ;==>IsDefault
Func IsNull($vKeyword)
Return IsKeyword($vKeyword) = $KEYWORD_NULL
EndFunc ;==>IsNull
----------------------------------------
|