How do you print how many specific text are in text?

How to print how many specific text are in text?

Split the text with specific text, you will get a list, get the length of list, minus 1.

1 Like

how

how can i do

one way

numbereOfWords

The Text box has 5 words.

I don't want this, I want to print how many times the word I specify appears.

Start a dictionary with words as keys and their counts as values, initially 0.

Loop through all your text word by word, setting
value(word) to value(word) + 1

What about trying the solution mentioned earlier?
You can find the split block in the text drawer and list blocks in the list drawer

A very good way to learn App Inventor is to read the free Inventor's Manual here in the AI2 free online eBook App Inventor 2 Book: Create Your Own Android Apps ... the links are at the bottom of the Web page. The book 'teaches' users how to program with AI2 blocks.
There is a free programming course here Course In A Box and the aia files for the projects in the book are here: App Inventor 2 Book: Create Your Own Android Apps
How to do a lot of basic things with App Inventor are described here: How do you...? .

Also do the tutorials Our Tutorials! to learn the basics of App Inventor, then try something and follow the Top 5 Tips: How to learn App Inventor

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

Adapted after https://imagnity.com/wp-content/uploads/2013/03/SearchAllOccurrencesInAList.png

The word 'I' appears 3 times. :wink:

thankyou very much

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.