Reputation: 3187
I'm trying to find a way to use NSNumberFormatter to format an input string of digits into a US phone number style.
For example: 4155552671 should be +1-415-555-2671 (if i'm not mistaken)
I was wondering if theres an easy way to do this with native API (NSNumberFormatterStyle?), instead of using my own logic to modify the string. any thoughts? Thanks.
Upvotes: 0
Views: 331
Reputation: 14304
This is not a suitable task for NSNumberFormatter
.
Maybe this answer can help.
There's also an iOS ported version of Google's phone number library which might help, you're probably looking for the RFC3966 output or a variation of the international one.
Upvotes: 1