简体   繁体   中英

How can i get prefix pf phone number?

Hello everyone I am trying to get prefix of phone numbers in order to get the actual phone number without country dialing code. How can I achieve this?

Please note that the phone numbers can be

123456789
0099123456789
+9912345678

or any other formats with country code and area code etc..

如果您尝试过这种方法,那么它将有所帮助,但不确定,

NSString *str=[PhoneNumber substringToIndex:[PhoneNumber length]-10];

Taking a look at the amount of different prefixes you can have List of country calling codes [wikipedia] and Internatioal dialing prefix [wikipedia], one could reach the conclusion that without narrowing the area down you'll probably not get very far with this.

If however you'll be handling phone numbers from a specific region to another specific region you might be able to come up with something.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM