is Valid Phone Number by regex - Android java.util.regex

Android examples for java.util.regex:Phone Number Pattern

Description

is Valid Phone Number by regex

Demo Code


//package com.java2s;
import android.text.TextUtils;

public class Main {
    public static final boolean isValidPhoneNumber(CharSequence target) {
        if (target == null || TextUtils.isEmpty(target)) {
            return false;
        } else {// ww  w. j av a  2  s.c  o  m
            return android.util.Patterns.PHONE.matcher(target).matches();
        }
    }
}

Related Tutorials