Can someone give me NSPredicate for validating string which are of the form:
1. Atleast one digit (0-9)
2. Followed by one or none of “.(0-9)”
So basically I want string like this to be valid:
2.34
84
1.0
2314234
3214.23123
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
One way to do this is:
Instead of using
NSPredicate, you can use theNSScannermethod- (BOOL)scanFloat:(float *)floatValue.