笨朱先行

我的工作,学习,生活,作品,收藏,人生……

  • Where am I?
  • 文章搜索:

    正文

    一个ASP验证EMAIL格式合法性的函数

        function IsValidEmail(email)
         dim names, name, i, c
         
         'Check for valid syntax in an email address.
         IsValidEmail = true
         names = Split(email, "@")
         if UBound(names) <> 1 then
         IsValidEmail = false
         exit function
         end if
         for each name in names
         if Len(name) <= 0 then
         IsValidEmail = false
         exit function
         end if
         for i = 1 to Len(name)
         c = Lcase(Mid(name, i, 1))
         if InStr("abcdefghijklmnopqrstuvwxyz_-.", c) <= 0 and not IsNumeric(c) then
         IsValidEmail = false
         exit function
         end if
         next
         if Left(name, 1) = "." or Right(name, 1) = "." then
         IsValidEmail = false
         exit function
         end if
         next
         if InStr(names(1), ".") <= 0 then
         IsValidEmail = false
         exit function
         end if
         i = Len(names(1)) - InStrRev(names(1), ".")
         if i <> 2 and i <> 3 then
         IsValidEmail = false
         exit function
         end if
         if InStr(email, "..") > 0 then
         IsValidEmail = false
         end if
        end function


    前一篇: 聚生网管——超牛的网络管理工具
    后一篇: 写留言本的时候文本域(textarea)的一些处理方法(原创)

    评论

    发表

    ◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。



    Powered By Z-Blog |
    ICP备案号:粤ICP备05077418号 Copyright 2007-2008 www.F6n.net Some Rights By Joe.