I am applying a search in a large content.Using NSRange to achieve this.
range = [textToSearch rangeOfString:searchText options:NSCaseInsensitiveSearch];
and then I am checking the presence of String like this:
if(range.location != NSNotFound){
//String found
}
Now I have only the Range for specified string. I want to display my search result as:
Suppose My Content is this:
I am a movie fanatic. When friends want to know what picture won the Oscar in 1980 or who played the police chief in Jaws, they ask me. My friends, though, have stopped asking me if I want to go out to the movies.
Now I have made a search for "Stopped"
Now I want to display my search as:
Result:
My friends, though, have stopped asking me if I want to
I want some word before and after searched result. I don't know how to acheive this.