I have an NSString called query which contains ~10 characters.
I would like to check to see if a second NSString called word contains all of the characters in query, or some characters, but no other characters which aren’t specified in query.
Also, if there is only one occurrence of the character in the query, there can only be one occurrence of the character in the word.
Please could you tell me how to do this?
NSString *query = @"ABCDEFJAKSUSHFKLAFIE";
NSString *word = @"fearing"; //would pass as NO as there is no 'n' in the query var.
The following answers the first half:
I need to think about the second half of the requirement.
Ok, the following code should fulfill both requirements: