I have a NSMutableArray which contains a few NSString objects. How can I test if the array contains a particular string literal?
I tried [array containsObject:@"teststring"] but that doesn’t work.
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.
What you’re doing should work fine. For example
Correctly logs “At index 1” for me. Two possible foibles:
indexOfObjectsendsisEqualmessages to do the comparison – you’ve not replaced this method in a category?NSNotFoundfor failure to locate, and not (say) 0.