网络编程
位置:首页>> 网络编程>> Asp编程>> ASP判断一个字符串中只包含字母和数字

ASP判断一个字符串中只包含字母和数字

 来源:asp之家 发布时间:2008-08-08 12:12:00 

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

用ASP判断一个字符串中只包含字母和数字要怎么做啊?

 


for s=1 to len(trim(user_id)) 
c = mid(user_id,s,1) 
if not ((c>="a" and c<="z") or (c>="A" and c<="Z") or (c>="0" and c<="9")) then  response.write "只能包含数字和字母!"
response.end
end if 
next 

user_id为要判断的字符串。

这个功能我们可以使用在用户注册的帐号的验证中!不让用户输入一些特殊的字符。

 

 

0
投稿

猜你喜欢

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