标题:[原创]请问这段代码是用来干什么的?
只看楼主
wendi
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2004-7-30
 问题点数:0 回复次数:1 
[原创]请问这段代码是用来干什么的?

<% function IsValidEmail(email)

dim names, name2, i, c

IsValidEmail = true names = Split(email, "@") if UBound(names) <> 1 then IsValidEmail = false exit function end if for each name2 in names if Len(name2) <= 0 then IsValidEmail = false exit function end if for i = 1 to Len(name2) c = Lcase(Mid(name2, i, 1)) if InStr("abcdefghijklmnopqrstuvwxyz_-.", c) <= 0 and not IsNumeric(c) then IsValidEmail = false exit function end if next if Left(name2, 1) = "." or Right(name2, 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

function strLength(str) ON ERROR RESUME NEXT dim WINNT_CHINESE WINNT_CHINESE = (len("会员")=2) if WINNT_CHINESE then dim l,t,c dim i l=len(str) t=l for i=1 to l c=asc(mid(str,i,1)) if c<0 then c=c+65536 if c>255 then t=t+1 end if next strLength=t else strLength=len(str) end if if err.number<>0 then err.clear end function %>

搜索更多相关主题的帖子: IsValidEmail names exit false function 
2004-08-15 16:12
griefforyou
Rank: 6Rank: 6
等 级:贵宾
威 望:27
帖 子:3336
专家分:0
注 册:2004-4-15
得分:0 

具体代码没仔细看,不过看看两个函数名就明白了

IsValidEmail 函数是验证Email地址合法性

strLength 是测试字符串字节长度的


天津网站建设 http://www./
2004-08-15 19:36



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-4281-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.064966 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved