Reputation:
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
Upvotes: 3
Views: 1531
Reputation: 5787
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.
Upvotes: 0
Reputation: 15511
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.
Upvotes: 7