Android Phone Number Check isLegalPhoneNumber(String phoneNumber)

Here you can find the source of isLegalPhoneNumber(String phoneNumber)

Description

is Legal Phone Number

Declaration

public static boolean isLegalPhoneNumber(String phoneNumber) 

Method Source Code

//package com.java2s;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
    public static boolean isLegalPhoneNumber(String phoneNumber) {
        String strPattern = "^((13[0-9])|(14[5,7])|(15[0-9])|(18[0-9]))[0-9]{8}$";

        Pattern p = Pattern.compile(strPattern);
        Matcher m = p.matcher(phoneNumber);
        return m.matches();
    }//from  w  w w. j  a  va 2s. c  o m
}

Related

  1. isPhone(String phoneNumber)
  2. isPhoneNumber(final String phone)
  3. isTelNumAvailable(String telNum)
  4. isMobile(String mobiles)
  5. isMobileNO(String phoneNum)
  6. checkPhone(String phone)
  7. isPhoneNumber(String phoneNum)