Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1899412
  • 博文数量: 606
  • 博客积分: 9991
  • 博客等级: 中将
  • 技术积分: 5725
  • 用 户 组: 普通用户
  • 注册时间: 2008-07-17 19:07
文章分类

全部博文(606)

文章存档

2011年(10)

2010年(67)

2009年(155)

2008年(386)

分类:

2008-08-29 17:01:18

/**
  * 判断是不是合法手机
  * handset 手机号码
 
*/
public static boolean isHandset(String handset) {
 
try {
  
if(!handset.substring(0,1).equals("1")) {
   
return false;
   }
  
if (handset==null || handset.length()!=11) {
   
return false;
   }
   String check
= "^[0123456789]+$";
   Pattern regex
= Pattern.compile(check);
   Matcher matcher
= regex.matcher(handset);
  
boolean isMatched = matcher.matches();
  
if(isMatched) {
   
return true;
   }
else {
   
return false;
   }
  }
catch (RuntimeException e) {
  
return false;
  }
}
阅读(542) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~