当前位置: 首页 > 图文教程 > 网络编程 > ASP > ASP实例:检测整数和长整数的函数

ASP
IIS的安装和配置全过程
多语言网站开发技术分析
ASP完美转化ACCESS为SQL数据库连接
解决IIS下UTF-8文件报错乱码的问题
ASP打开任何类型文件提示保存
ASP教程:Stream 速查
asp生成UTF-8格式的文件
动态网站建站应知应会
2000/XP IIS配置问题
怎样在xp下配置iis
ASP教程:数组数据排序的程序例子
ASP教程:ASP是不区分大小写
一些语言的标识符的命名规则
ASP教程:表单内容提交到XML文件中
ASP是不是值得学习呢?
详细的关于ASP缓存类的教程
ASP教程:ASP关于数组的应用技巧
ASP教程:Expires 属性的介绍
SQL关于特殊字符处理的基本方法
XMLHTTP实时进行表单数据的校验

ASP实例:检测整数和长整数的函数


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-28   浏览: 29 ::
收藏到网摘: n/a

检测整数和长整数的ASP函数

<%
'检测字符串是否是整数
Function Is_Int(a_str)
    If not isnumeric(a_str) or len(a_str) > 5 Then
        Is_Int = false 
        Exit Function 
    Elseif len(a_str) < 5 then
        Is_Int = true 
        Exit Function 
    End if 
    If cint(left(a_str , 4)) > 3276 Then
        Is_Int = false
        Exit Function
    Elseif cint(left(a_str , 4)) = 3276 And cint(right(a_str , 1)) > 7 Then
        Is_Int = false
        Exit Function
    Else
        Is_Int = true
        Exit Function
    End if 
End Function

'检测是否是长整数
Function Is_Lng(a_str)
    If not isnumeric(a_str) or len(a_str) > 10 Then
        Is_Lng = false
        Exit Function 
    Elseif len(a_str) < 10 Then
        Is_Lng = true 
        Exit Function 
    End If 
    If clng(left(a_str , 9)) > 214748367 Then
        Is_Lng = false
        Exit Function
    Elseif clng(left(a_str , 9)) = 214748367 And clng(right(a_str , 1)) > 7 Then
        Is_Lng = false
        Exit Function
    Else
        Is_Lng = true
        Exit Function
    End If 
End Function
%>