If there are two separate strings, we need to retrieve all words that are matching (in those strings), in an array. also this matching should be case insensitive. What will be the most efficient way to achieve this.
For Example:
NSString *s1 = @"Hello there, I want to match similar words.";
NSString *s2 = @"Do you really want to match word, hello?";
The resulting array should contain, "hello", "want", "to", "match".
I went through many questions and, responses over the net like Regular expression to match a line that doesn't contain a word?, but didn’t, find solution needed.
You can use NSMutableSet for this..
This Solution will work for you, If you don’t have any punctuations in the sentences.. If you want sentences with punctuations to work just remove all the punctuations in your sentences.