WordCount ["string"]
gives the total number of words in string.
WordCount
WordCount ["string"]
gives the total number of words in string.
Details
- Character sequences in "string" that are not identified as being part of words are excluded from WordCount .
Examples
open all close allBasic Examples (1)
Count the number of words in a string:
Properties & Relations (2)
The empty string has 0 words:
Hyphenated words are treated as a single word:
Neat Examples (1)
Find the sentence with the most words in a book:
Compare to the longest sentence by string length:
Related Guides
History
Text
Wolfram Research (2015), WordCount, Wolfram Language function, https://reference.wolfram.com/language/ref/WordCount.html.
CMS
Wolfram Language. 2015. "WordCount." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/WordCount.html.
APA
Wolfram Language. (2015). WordCount. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/WordCount.html
BibTeX
@misc{reference.wolfram_2025_wordcount, author="Wolfram Research", title="{WordCount}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/WordCount.html}", note=[Accessed: 04-December-2025]}
BibLaTeX
@online{reference.wolfram_2025_wordcount, organization={Wolfram Research}, title={WordCount}, year={2015}, url={https://reference.wolfram.com/language/ref/WordCount.html}, note=[Accessed: 04-December-2025]}