Why does the libphonenumber site return a different result from the libphonenumber library?

I use the link below:

http://libphonenumber.googlecode.com/svn/trunk/javascript/i18n/phonenumbers/demo-compiled.html
  • phone number: 96596032346
  • region code: KW

the link returns that the number is valid.

I am using a library in C # as shown below:

 PhoneNumberUtil phoneUtil = PhoneNumberUtil.GetInstance();
 phoneNumber = PhoneNumberUtil.Normalize(phoneNumber);
 PhoneNumber nb = phoneUtil.Parse(phoneNumber, regionCode);
 bool isValid = phoneUtil.IsValidNumber(nb);

I pass the same parameters phoneNumber=96596032346and regionCode=KW, but it returns that the number is invalid.

I checked some updates for the library, but I have the latest version. What could be the problem?

+4
source share
2 answers

I found that there is version 5.8 for C #, but this version is not updated in nuget packages, so I downloaded the DLL file and embedded it in the project ...

worked great :)

0
source

An interesting library.

- , / , , .

String swissNumberStr = "044 668 18 00"
PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance();
try {
  PhoneNumber swissNumberProto = phoneUtil.parse(swissNumberStr, "CH");
} catch (NumberParseException e) {
  System.err.println("NumberParseException was thrown: " + e.toString());
}

, Normalize?

0

Source: https://habr.com/ru/post/1544034/


All Articles