(words: String) → Array

This macro takes a string and creates an Array of each word (“word” meaning a sequence of non-whitespace characters) in the string.

Example usage:

(words: "god-king Torment's peril") is the same as (a: "god-king", "Torment's", "peril")


It can be useful to explicitly distinguish individual words within a string, in a manner not possible with just the contains operator - for instance, seeing if a string contains the bare word “to” - not “torn” or any other larger word. This macro allows a string's words to be split up and examined individually - you can safely check if (words: $a) contains "to", or check on a particular word in the sequence by asking if, say, (words: $a)'s 2nd is 'goose'.


If the string was empty or contained only whitespace, then this will create an empty array. Moreover, if the string contained no whitespace, then the array will contain just the entire original string.

The whitespace characters recognised by this macro include line breaks, non-breaking spaces, and other uncommon space characters.

See also: