网络编程
位置:首页>> 网络编程>> Asp编程>> ASP中如何判断字符串中是否包含字母和数字

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

  发布时间:2009-07-10 13:12:00 

标签:字符串,数字,字母

ASP中判断字符串中是否包含字母和数字的两个函数

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

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com