libPhoneNumber-iOS icon indicating copy to clipboard operation
libPhoneNumber-iOS copied to clipboard

Parsing Wrong

Open astraqube opened this issue 6 years ago • 1 comments

I am parsing this number : 510766XXXX And selected country code : +91

And its giving that its a valid number.

But the number 5107666701 for USA and the country code : +91 is for INDIA.

I am parsing like this: let phoneNumber: NBPhoneNumber = try phoneUtil.parse("510766XXXX", defaultRegion: "IN") let boolNumber : Bool = phoneUtil.isValidNumber(phoneNumber)

Its giving true but it should be False.

Because the number is from USA and the selected country code is INDIA.

Please correct me if i am doing wrong. I am looking into this from many days. Please help me out. @phatmann @simX @youknowone @hashier @meiwin

Thanks

astraqube avatar Apr 17 '18 06:04 astraqube

My guess is that it is a valid number in India, so it is returning it as true. (hence it should not return false).

Area code 510 is for landlines in Jhansi (in Uttar Pradesh). It is possible for US, India and other countries to have valid 510766XXXX numbers.

nitinalabur avatar May 02 '18 20:05 nitinalabur