0

大家好,我正在尝试获取电话号码的前缀,以便在没有国家/地区拨号代码的情况下获取实际电话号码。我怎样才能做到这一点?

请注意,电话号码可以是

123456789
0099123456789
+9912345678

或任何其他带有国家代码和地区代码等的格式。

4

2 回答 2

0

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.

于 2013-04-19T11:39:12.177 回答
0

如果你这样尝试,那么它会有所帮助但不确定,

NSString *str=[PhoneNumber substringToIndex:[PhoneNumber length]-10];
于 2013-04-19T10:50:41.077 回答