My Pell solver is only supposed to solve Diophantine equations, which are equations with integers. I have some text fields for the parameters, and `NSString`

deals with this just fine: to get the integer value from a text field, simply do:

int n = [[nField stringValue] intValue];

This assumes that you have an `IBOutlet NSTextField *nField`

to read from. This works pretty well; the parser stops when it encounters something it doesn’t like, so if you type in “foo”, n will just be 0. You won’t get errors. However, it doesn’t look so good for the user when this happens. You can use a number formatter to make sure the user can only type in valid integers. Here is a complete implementation of an integer formatter: