erezak / libphonenumber-csharp

Forking original c# port
Apache License 2.0
198 stars 79 forks source link

Determining the country code of a string phone number? #25

Open fonix232 opened 7 years ago

fonix232 commented 7 years ago

I'm using this library for server-side phone number management, however ran into a little bit of an issue.

The Java counterpart works fine with the PhoneNumberUtil.getInstance().parse("phonenumber here","") format, automatically determining the country code. However the .Net version (this) requires a valid country identifier, which I unfortunately do not have specified for the phone numbers.

In my service, I send out verification text messages based on country. This means I have to determine the country the phone number originates from.

How can I do this with this library?

jimbo8098 commented 4 years ago

You can use null in place of the "" here, I just did this to check up on #32 . You'll need to use the most recent version of the tool which considering the post date probably isn't the case :)