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

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

  发布时间:2008-07-21 12:04:00 

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

下面两个函数实现了对字符串中数字的判断。

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= "123aspxhome.com"  
if   isnaw(pw)   then    
response.write   "y "  
else  
response.write   "n "  
end   if      
0
投稿

猜你喜欢

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