Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.text.TextUtils;

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

public class Main {

    public static boolean checkPhone(String num) {
        String mobile = num;
        if (TextUtils.isEmpty(mobile)) {
            return false;
        }
        String exp = "(1)[0-9]{10}$";
        Pattern p = Pattern.compile(exp);
        Matcher m = p.matcher(mobile);
        boolean isPhoneNum = m.matches();
        return isPhoneNum;
    }
}