Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.support.annotation.NonNull;

import java.util.regex.Pattern;

public class Main {

    public static boolean isLandlinePhone(@NonNull String phone) {
        return Pattern.matches(
                "(\\d{11})|^((\\d{7,8})|(\\d{4}|\\d{3})-(\\d{7,8})|(\\d{4}|\\d{3})"
                        + "-(\\d{7,8})-(\\d{4}|\\d{3}|\\d{2}|\\d{1})|(\\d{7,8})-(\\d{4}|\\d{3}|\\d{2}|\\d{1}))$",
                phone);
    }
}