• 微软的IsNumeric函数有错误


    随便建立一个asp文件,然后输出Response.Write(IsNumeric("2d3"))你看看就知道了,对此,自己写了一个函数来替代之,代码如下,用法与IsNumeric完全相同,只不过是函数名字不同罢了(没办法,这个函数不允许重写,所以只好重命名一个函数):

    //如果要轉載本文請注明出處,免的出現版權紛爭,我不喜歡看到那種轉載了我的作品卻不注明出處的人 Seven{See7di#Gmail.com}

    <%
    Function IsNum(Values)
    IsNum = False
    If IsNull(Values) Or Len(Values)=0 Then
       IsNum = False
       Exit Function
    End If
    Dim Regex
    Set Regex = new Regexp
       regex.Global = False
       regex.IgnoreCase = False
       regex.Pattern="^[-]{0,1}[0-9]{0,}[.]{0,1}[0-9]{0,}$"
       IsNum=regex.Test(Values)
    Set Regex=Nothing
    End Function

    Dim a(11),iNum
    a(0) = "-.1"
    a(1) = "-1.1"
    a(2) = "-0.1"
    a(3) = "0.1"
    a(4) = ".1"
    a(5) = "111.132234345345354"
    a(6) = "+.1"
    a(7) = "111"
    a(8) = "asfd.1"
    a(9) = "-1"
    a(10) = "188.188.188"
    a(11) = "18a8.1"
    Response.Write "<table border=1>"
    For i = 0 to 11
        Response.Write "<tr><td>" & a(i) & "</td><td>" & IsNum(a(i)) & "</td>"
    Next
    Response.Write "</table>"
    %>


  • 相关阅读:
    堆中的路径
    二叉搜索树的操作集
    windows 利用凭据进行远程连接
    解决通过域名访问不了
    Linux 安装redis
    mybatis之resultType
    nuxt 引入swiper插件报错 Cannot resolve swiper/dist/css/swiper.css
    windows 设置连接linux redis
    linux 安装redis报gcc错误
    maven打包好的jar安装到本地库
  • 原文地址:https://www.cnblogs.com/see7di/p/2239930.html
Copyright © 2020-2023  润新知