So I basically have an array of words and phrases. Some of them contain curses. I want to create a method that automatically scans each of the units in the array for curses. If
I'd do two nested for-loops. The first loop to scan over the phrase array and the second over the word array. In semi-pseudocode, something like:
NSMutableArray *filtered ... // etc.
// Loop over each phrase.
for (NSString *phrase in phrases) {
// Let's assume it's acceptable
bool good = true;
for (NSString *word in words) {
// If we find a single unwanted word, we'll no longer take it
if ([phrase rangeOfString:word].location != NSNotFound) {
good = false;
break; // We don't need to keep iterating.
// We already know it's not aceptable.
}
}
if (good) [filtered insertObject:phrase];
}