I am trying to write code to verify that my user only input numbers 0 through 9 and/or a decimal. I need to verify that data input into a text field is only a float (ex. 10.3)
I am a n00b but figure I'd have to use characterSetWithCharactersInString to verify the input.
SO far, this is what I have...yes, only this.
Am I even on the right track or completely off base in doing this kind of verification? I started by only using the numpad keyboard but that does not allow the decimal so figured I would need to use a keyboard with more items but now, I don't want erroneous keys like '?' or 'm' etc.
I have no idea what to do to verify the data. Can you all assist?
I am a n00b but figure I'd have to use characterSetWithCharactersInString to verify the input.
SO far, this is what I have...yes, only this.
Code:
- (IBAction)buttonclick:(id)sender
{
[textBox resignFirstResponder];
NSCharacterSet *NumberSet = [NSCharacterSet characterSetWithCharactersInString:@"0123456789."];
Am I even on the right track or completely off base in doing this kind of verification? I started by only using the numpad keyboard but that does not allow the decimal so figured I would need to use a keyboard with more items but now, I don't want erroneous keys like '?' or 'm' etc.
I have no idea what to do to verify the data. Can you all assist?