### Counting and extracting words

word("string",n) returns the nth word in string. For example, word("one two three",2) returns the string "two".

words("string") returns the number of words in string. For example, words(" a b c d") returns 4.

The word and words functions provide limited support for quoted strings, both single and double quotes can be used:

         print words("\"double quotes\" or 'single quotes'")   # 3

A starting quote must either be preceded by a white space, or start the string. This means that apostrophes in the middle or at the end of words are considered as parts of the respective word:

         print words("Alexis' phone doesn't work") # 4

Escaping quote characters is not supported. If you want to keep certain quotes, the respective section must be surrounded by the other kind of quotes:

         s = "Keep \"'single quotes'\" or '\"double quotes\"'"
         print word(s, 2) # 'single quotes'
         print word(s, 4) # "double quotes"

Note, that in this last example the escaped quotes are necessary only for the string definition.