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 allclose all

Basic 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:

Wolfram Research (2015), WordCount, Wolfram Language function, https://reference.wolfram.com/language/ref/WordCount.html.

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_2024_wordcount, author="Wolfram Research", title="{WordCount}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/WordCount.html}", note=[Accessed: 22-December-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_wordcount, organization={Wolfram Research}, title={WordCount}, year={2015}, url={https://reference.wolfram.com/language/ref/WordCount.html}, note=[Accessed: 22-December-2024 ]}