首页 >> Asp编程 >> Asp新手入门 >> ASP中如何判断字符串中是否包数字

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

时间:2008-7-21 网友评论条 【

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

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      
站长工具
百度相关搜索查询:
相关文章
loading 请稍等,评论加载中...

Aspxhome.com. 中国Asp之家. 版权所有

闽ICP备06017341号