凹丫丫网络社区's Archiver

Amm 发表于 2008-5-15 16:33

一个EMail效验函数(by Loutonghua)

<FONT face=新宋体 color=#ff6600>&lt;%<BR>function IsValidEmail(email)<BR><BR>dim names, name, i, c<BR><BR>'Check for valid syntax in an email address.<BR><BR>IsValidEmail = true<BR>names = Split(email, "@")<BR>if UBound(names) &lt;&gt; 1 then<BR>IsValidEmail = false<BR>exit function<BR>end if<BR>for each name in names<BR>if Len(name) &lt;= 0 then<BR>IsValidEmail = false<BR>exit function<BR>end if<BR>for i = 1 to Len(name)<BR>c = Lcase(Mid(name, i, 1))<BR>if InStr("abcdefghijklmnopqrstuvwxyz_-.", c) &lt;= 0 and not IsNumeric(c) then<BR>IsValidEmail = false<BR>exit function<BR>end if<BR>next<BR>if Left(name, 1) = "." or Right(name, 1) = "." then<BR>IsValidEmail = false<BR>exit function<BR>end if<BR>next<BR>if InStr(names(1), ".") &lt;= 0 then<BR>IsValidEmail = false<BR>exit function<BR>end if<BR>i = Len(names(1)) - InStrRev(names(1), ".")<BR>if i &lt;&gt; 2 and i &lt;&gt; 3 then<BR>IsValidEmail = false<BR>exit function<BR>end if<BR>if InStr(email, "..") &gt; 0 then<BR>IsValidEmail = false<BR>end if<BR><BR>end function<BR>%&gt;</FONT>

oyaya 发表于 2008-5-15 17:09

你没有把用法写出来啊
好象是我的文章系统里的那段代码

页: [1]

Powered by Discuz! Archiver 7.0.0  © 2001-2009 Comsenz Inc.