Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Word counter
- DogeTheKitten
-
54 posts
Word counter
How do I find the number of words in an answer, like the:
block? like if the answer was “hello world”, how would I count the words?
Last edited by DogeTheKitten (Feb. 28, 2018 17:37:50)
- KingOfAwesome58219
-
1000+ posts
Word counter
Go through a string, adding every letter to the same line. When you encounter a space, add a new line and start adding to that instead. Remove all blank values in the list, and just use the length of the list.
Here's an example:
Here's an example:
Last edited by KingOfAwesome58219 (Feb. 28, 2018 18:38:37)
- gor-dee
-
1000+ posts
Word counter
here's what I did
it doesn't separate the words and put them in a list, just gives you a word count. It should work even if the answer has multiple spaces at the beginning, middle or end which I think might break the example above (although I haven't tested it)
Last edited by gor-dee (Feb. 28, 2018 21:34:20)
- Dabman2392
-
100+ posts
Word counter
If you are using it to make noises for the amount of characters that there are in an answer, then, use this:
Last edited by Dabman2392 (Dec. 17, 2020 17:45:47)
- Discussion Forums
- » Help with Scripts
-
» Word counter