I would know how retrieve an index of an NSArray using a NSPredicate ?
NSArray *array = [NSArray arrayWithObjects:
@"New-York City",
@"Washington DC",
@"Los Angeles",
@"Detroit",
nil];
Which kind of method should I use in order to get the index of "Los Angles" by giving only a NSString?
NB: @"Los An" or @"geles" should return the same index.
Using NSPredicate you can get array of strings that contain your search string (it seems there’s no built-in method to get just element indexes):
You can get only indexes using
indexesOfObjectsPassingTest:method:If you want to get just one element containing your string you can use similar
indexOfObjectPassingTest:method for that.