用java怎么验证一个字符串是手机号码?有比较全面的算法吗

解决方案 »

  1.   

    手机号码有什么具体的规则?
    13000000000~~13999999999之间吧?
    13000000000<mobileNum<13999999999
      

  2.   

    (13000000000<mobileNum<13999999999)||(15900000000<mobileNum<15999999999)
      

  3.   

    if(number.length()==11 && (number.startsWith("13") || number.startsWith("15")))
       return true;
    else
       return false;只能判断国内的,国外的只有知道人家的规定才能判断。
      

  4.   

    return str.matches("13\\d{9}")||str.matches("159\\d{8}");
      

  5.   

    国外的不知道,国内的就用正则表达式进行处理<要注意现在有159号段>,主要是各国的手机号段都不是统一的