[英]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 123456789
0099123456789 0099123456789
+9912345678 +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. 看一下您可以使用的国家/地区电话代码清单 [wikipedia]和国际拨号前缀 [wikipedia]的数量,您可能会得出这样的结论:如果不缩小范围,您可能会对此不太了解。
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. 但是,如果您要处理从特定区域到另一个特定区域的电话号码,您也许可以提出一些建议。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.