ASP字母数字判断代码如何判断字符串包含字母或者数字

<%
' https://www.chinaobd2.com 系统字符串验证代码 function isnaw(str) for i=1 to len(str) str1=mid(str,i,1) if isnumeric(str1) then isn=1 if (Asc(str1)>Asc("a") and Asc(str1)<Asc("z")) or (Asc(str1)>Asc("A") and Asc(str1)<Asc("Z")) then isw=1 next if isn=1 and isw=1 then isnaw=true else isnaw=false end if end function pw="123qq" if isnaw(pw) then response.write "y" else response.write "n" end if %>

 工作中,经常会遇到需要判断一个字符串是否包含字母或者数字,字符串是否是纯数字,或者电话号码等需求,这里为大家分享这段代码。 

posted @ 2022-02-12 23:16  hilong911  阅读(309)  评论(0编辑  收藏  举报