Search through text word by word
I’d like to search through a txt file for a particular word. If I find that word, I’d like to retrieve the word that immediately follows it in the file. If my text file contained:
"My name is Jay and I want to go to the store"
I’d be searching for the word
"want", and would want to add the word
"to" to my array. I’ll be looking through a very big text file, so any notes on performance would be great too.