words
Counts the words in some text.
Keyboard Maestro: WORDS
Details #
words(text) takes exactly one argument and returns how many words it holds. A word is any run of characters between spaces, tabs or line breaks, so punctuation stays attached to its word. A number, true/false or list is turned into text first (see string), and nothing is 0.
Parameters #
Takes 1 argument.
{{ words(text) }}
Examples #
words("one two three")→
3words(text)→
6| Sample variable | Value |
|---|---|
text | The quick brown fox
jumps over |
Gotchas #
Calling it with no argument or two arguments is an error:
words() takes 1 argument, got 2.words("well-known")is 1: a hyphen or apostrophe does not split a word.