NSString *test = @"example";
NSString *test2 = @"ex12am243ple";
Is there any easy way to determine which string contains a number in it (0-9) and which one doesn’t?
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.
p.s. you can look at the docs of
NSCharacterSetfor the available ones, but the one you probably want isdecimalDigitCharacterSetso you would use[NSCharacterSet decimalDigitCharacterSet]in place of “characterSetOfNumbers” in the above code.