Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import android.text.TextUtils;

public class Main {
    public static boolean isFixedPhoneNumber(String telNum) {
        if (TextUtils.isEmpty(telNum)) {
            return false;
        }

        telNum = telNum.replaceAll("^\\+{0,1}86", "");

        boolean flag = false;
        if (telNum.matches("^0[1|2]\\d[1-9]\\d{4,6}$")) {
            flag = true;
        } else if (telNum.matches("^0[3-9]\\d{2}[1-9]\\d{4,5}$")) {
            flag = true;
        }

        return flag;
    }
}