Android Convert phone number in international format

I would like to know if it is possible to convert phone numbers to international format when outgoing call.

For example, if a French user (sorry, this is the only format that I know i will not make a mistake :-) try to call in the national format: 01.47.12.34.56, then the method will convert it to the international format for example: +33.1.47.12.34.56

I looked at the PhoneNumberUtils document, but I don’t know if there is a way to do what I want.

+3
source share
2 answers

An old post, but if it helps someone: use the google libphonenumber library to do all kinds of formatting and checking for phone numbers. In this particular case, to convert to the international format, use the format(PhoneNumber number, PhoneNumberFormat format)api in the class PhoneNumberUtilin the same library.

+5
source

Is the number included as a string?

With Java string methods, can you do it yourself if I'm not mistaken?

So take a String, copy 0 and add +33

0
source

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


All Articles