Count the number of words in a sentence/paragraph?

can i get help for this

In the button click event, take the length of list of the results of splitting the textbox.Text at blanks.

can you send me the picture of blocks and designer.The question is :The app will have a text input for users’ input, a submit button and a label to display results.
When the Submit button is clicked, the app should count each word in the users’ input. This
must use a loop. Once your code has finished counting the words, it should display in the label
with each word that appeared in the sentence the count of how many times that word
appeared. For example, if the user entered in the sentence “For a for loop count a count”, the
output would be “for: 2, a: 2, loop: 1, count: 2”

That's a different problem, requiring a dictionary and a downcase block to deal with that capital letter.

The keys of the dictionary are the lower case words, and the values are the counts, default 0.

Downshift the input, split at blanks, then loop through the list.
For each word in the list, set the value in the dictionary at that word to 1 + the value at that word.

Then loop through the dictionary and use the text JOIN block to build up the result text from empty, tag/value by tag value, JOINing it to itself piece by piece.
', '

where is the answer such as image for this solution

Is this is school assignment? It sounds like it is. We are not here to do your homework for you. Try yourself with the designer and the blocks. After that show what you have tried.

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


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

I had prepared a wonderful solution for this, but I tripped and spilled the blocks onto the floor.

Here are the sweepings.

word_counter.aia (2.0 KB)


A Parsons problem :grin:


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