IsInt

首页  后退  前进

IsInt
down2

IsInt

检测变量或表达式是否没有小数部分.

 

IsInt ( variable )

参数

variable

要检查的变量/表达式

返回值

成功:

返回 1 - 没有小数

失败:

返回 0 - 存在小数

备注

如果该值是一个没有小数的浮点数 (例如 1.000), 该函数将返回 1.

详细说明参考 语言参考-数据类型.

 

函数示例

#include <MsgBoxConstants.au3>
Example()
Func Example()
    Local $bIsInt1 = IsInt(-12345) ; Returns 1
    Local $bIsInt2 = IsInt(3.0000) ; Returns 1
    Local $bIsInt3 = IsInt("5432") ; Returns 0 as the value is a string.
    Local $bIsInt4 = IsInt(7.5 - 4.5) ; Returns 1 since it evaluates to integer 3
    MsgBox($MB_SYSTEMMODAL, "", "IsInt: " & @CRLF & _
            $bIsInt1 & @CRLF & $bIsInt2 & @CRLF & $bIsInt3 & @CRLF & $bIsInt4)
EndFunc   ;==>Example

----------------------------------------

 

该函数可以通过命令 exect 调用

参见:

IsNumber, IsArray, IsFloat, IsString, StringIsInt, IsBinary, VarGetType

例子
copy
IsInt(-12345) ; 返回1

IsInt(3.0000) ; 返回1,因为值为3的整数

IsInt('5432') ; 返回0,因为这是字符串

IsInt(7.5-4.5) ; 返回1,因为结果是3的整数

 

exect=$var_n=3.14159||$var_i=IsInt($var_n)||_ViewValues($var_i) ;; 检查变量是否是整数数据类型的示例

up2

tcimage © Аверин Андрей для Total Commander Image Averin-And@yandex.ru