isPossibleNumber vs. isValidNumber
Asked Answered
C

1

13

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?

Cureton answered 19/8, 2016 at 10:23 Comment(0)
B
19

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.

Bale answered 19/8, 2016 at 10:25 Comment(1)
This means that using both isPossibleNumber and isValidNumber is more performant than just using isValidNumber alone if you have invalid numbers in your list?Adna

© 2022 - 2024 — McMap. All rights reserved.