WLJS LogoWLJS Notebook

TextWords

TextWords["string"] gives a list of the runs of characters identified as words in string.

  • TextWords["string", n] gives the first n words in string.

Examples

Extract all words:

TextWords["The quick brown fox"]
(* {"The", "quick", "brown", "fox"} *)

Get first 3 words:

TextWords["Hello world, this is a test", 3]
(* {"Hello", "world", "this"} *)

Count words in text:

Length[TextWords["One two three four five"]]
(* 5 *)

Please visit the official Wolfram Language Reference for more details.

On this page