I need to validate some NSString that user inputs in some UITextField.
There are 2 kinds of validation I need.
1st, to judge whether a NSString object is a legal decimal number.
For example, @”100″, @”10.1″,@”0.11″, are all legal, but @”100.11.1″ is not.
2nd, to judge whether a NSString object is not a space-only string.
For example, @”abc”, @”ab—-c”, are all legal, but @”—–“, @””, are not.
here “-” means a space ” “.
How can I validate these 2 kinds of NSString?
Thanks a lot!
For the first part try this
For the second part try this: