3

NSString *phoneNumber = @"2310234432"; I would like to create a new string out of the above but format the phone number according to the current localization. Is there a "native" way I can do this or do I have to write my own methods to return it for every locale ?

Thanx

4

2 回答 2

7

Apple has not provided a public API for displaying localised phone numbers, so this is a non-trivial task. Back in iPhone OS 2.x, Apple packaged a filed within the SDK called UIPhoneFormats.plist which provided a list of all the phone localisation formats, but they've since removed it from recent OSes and SDKs.

Please make sure you file a radar:// bug for this, because it's a common request.

于 2009-09-05T11:37:28.720 回答
0

There is nothing that can do this.

And in fact is it probably not a good idea to store phone numbers in NStrings Think about 1-800-COLLECT. Convert that to numbers, and the friendly phone number is gone.

于 2009-09-25T21:05:38.813 回答