PDA

View Full Version : How to format??




arnieterm
Oct 15, 2008, 10:08 AM
I have an NSString that contains the phone # [only phone number]. I want to format this string to display in this way "###-###-####". What parameter should I pass to stringWithFormat or initWithFormat?
Can anybody suggest?
Thanks



robbieduncan
Oct 15, 2008, 10:19 AM
Personally I'd use the class that's actually designed for formatting numbers. The well documented NSNumberFormatter (http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSNumberFormatter_Class/Reference/Reference.html).