ASP数据类型判断检测——整数校验函数,判断传入的字符串是否是整型字符,通过循环逐一判断每个字符,精确判断并返回true或false。函数代码:
Public function isInteger(para) on error resume Next Dim str Dim l,i If isNUll(para) then isInteger=false exit function End if str=cstr(para) If trim(str)="" then isInteger=false exit function End if l=len(str) For i=1 to l If mid(str,i,1)>"9" or mid(str,i,1)<"0" then isInteger=false exit function End if Next isInteger=true If err.number<>0 then err.clear End Function
判断数字是否为整数,可用于参数合法性判断。