I think you want to find if given string contains at least one of the strings contained in the array to ban abusive words
- (BOOL) checkIfOfStringOfArray: (NSArray *) array inString: (NSString *) string {
for (NSString * element in array) {
if ([string containsString: element]) return YES;
}
return NO;
}
Call like:
BOOL hasAbusiveString = [self checkIfOfStringOfArray: self.abusiveArray inString:self.txtChat.text.lowercaseString];
0
solved Convert a swift function in objective-c