java,php,asp.net,linux,javascript,mysql,mssql,oracle,编程

判断是不是合法手机

转载请注明:http://www.pmjava.com/Article/ShowInfo.asp?ID=56555
/**
  * 判断是不是合法手机
  * 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;
  }
}
}
                                                                  

posted on 2009-06-10 21:15 rrong_m 阅读(72) 评论(0)  编辑  收藏

<2025年5月>
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567

导航

统计

常用链接

随笔档案

文章分类

文章档案

java编程

搜索

积分与排名

最新评论

阅读排行榜

评论排行榜