diff --git a/core/java/android/provider/Telephony.java b/core/java/android/provider/Telephony.java index 7a6f6bb5c0a22..0207330259e60 100644 --- a/core/java/android/provider/Telephony.java +++ b/core/java/android/provider/Telephony.java @@ -1263,6 +1263,21 @@ public final class Telephony { return match.matches(); } + /** + * Returns true if the number is a Phone number + * + * @param number the input number to be tested + * @return true if number is a Phone number + */ + public static boolean isPhoneNumber(String number) { + if (TextUtils.isEmpty(number)) { + return false; + } + + Matcher match = Regex.PHONE_PATTERN.matcher(number); + return match.matches(); + } + /** * Contains all MMS messages in the MMS app's inbox. */