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:

Introduced in 2015
 (10.1)