Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

isPossibleNumber vs. isValidNumber

I am using Google's libphonenumber library to validate phone numbers on the server-side and I noticed that PhoneNumberUtil has two methods for doing this: isPossibleNumber and isValidNumber. What is the difference between them and when should I be using one rather than the other one?

like image 571
Lynn Avatar asked Aug 19 '16 10:08

Lynn


1 Answers

You can find their difference in their github page.

isPossibleNumber - quickly guessing whether a number is a possible phonenumber by using only the length information, much faster than a full validation.

isValidNumber - full validation of a phone number for a region using length and prefix information.

like image 191
Ömer Faruk AK Avatar answered Oct 06 '22 22:10

Ömer Faruk AK