ASP中如何判断字符串中是否包含字母和数字

http://www.xishui.net 2008年07月13日19:44 浠水网

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



function   checks(c)   
    dim   str,str1
    str1=c
    intlen=len(c)
    for   i=0   to   intlen
    str=   Asc(str1)
            if   (str 《48   or   str> 57)and(str 《65   or   str> 90)and(str 《97   or   str> 122)   then
            checks=0
            else
            checks=1             
            end   if
          str1=right(c,intlen-i)   '依次判断字符ASCII值
            next           
    end   function
发表评论
上一篇asp 实现检测字符串是否为纯字母和数字组合的函数
下一篇在JAVASCRIPT中LEFT,RIGHT,MID函数的等价函数
正在加载中……