Showing posts with label counting up a repeated word in a sentence. Show all posts
Showing posts with label counting up a repeated word in a sentence. Show all posts

Friday, August 18, 2017

Recipe and walkthrough: counting up repeats of a word in a sentence



How do you count up the occurrences of <word> in a sentence? (or, in this case, find how many times "Nintendo" is in a 538?

sum(forEach(value.split(" "), temp, if(temp.contains("Nintendo"), 1, 0)))
 
Explanation: