views:

636

answers:

2

Hello everyone.

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

+5  A: 

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.

Nathan de Vries
A: 

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.

Mihai Nita