How to count the number of identical words?

selevo

New member
I saved the text on the screen into a variable and now I’m thinking about how to count how many times a word is repeated: "search"
in saved text. So far I have not found any simple solutions, :)
I hope for collective wisdom.
 
Last edited:

hsurB

Well-known member
I am assuming its dictionary/array where the text is stored and you want to count words in text, not id so it would be iterator's value not key.

But then if this word appears twice in one iterator's value it would add 1 to variable anyway 🤔

Maybe there should be some kind of text manipulation integrated into that to check how many times word appears in each key's value first? And then save it under another integer and just add them at the end.
I'll think about it. Unless someone has it already figured out
 

Attachments

  • Screenshot_20240317_090353_MacroDroid.png
    Screenshot_20240317_090353_MacroDroid.png
    256.2 KB · Views: 7
Last edited:

Dm114

Well-known member
I saved the text on the screen as a variable and now I’m thinking about how to count how many times a word is repeated: search. So far I haven't found any single action solutions :) I hope for collective wisdom.
Do you want to scan every word and calculate the number of occurrences for each of them or are you looking for a specific word?
 

selevo

New member
Do you want to scan every word and calculate the number of occurrences for each of them or are you looking for a specific word?
I want to count how many identical words are in the text.
In this case, how many words are "search".
 
Top