String search in string array in objective c

Filthy Knight picture Filthy Knight · May 10, 2010 · Viewed 96.9k times · Source

I want to search a specific string in the array of strings in objective c. Can somebody help me in this regard?

Answer

JeremyP picture JeremyP · May 10, 2010
BOOL isTheObjectThere = [myArray containsObject: @"my string"];

or if you need to know where it is

NSUInteger indexOfTheObject = [myArray indexOfObject: @"my string"];

I strongly recommend you read the documentation on NSArray. It's best to do that before posting your question :-)