Strange question here.
I have a file .txtthat I want to iterate over. I can get all the words from the array from the file, which is good, but what I want to know how to do is how I can iterate over the whole file, but not the individual letters, but the words themselves.
I want to be able to go through an array in which all the text from the file is located, and basically count all the instances in which the word appears in it.
The only problem is that I do not know how to write code for it.
I tried using a for loop, but it's just iterating over each individual letter when I need whole words.
source
share