Tag Archives: NSNumberFormatter

How to turn an NSString into an NSNumber

We can use an NSNumberFormatter for this. It’s a bit like converting an NSString into an NSDate.

Here’s how:

Assuming that we’d like to collect input from a text field (set to accept number pad input only) myNumber will now be an NSNumber instead of text.