The following functions perform text processing operations:
1 – ADDPREFIX
$(ADDPREFIX prefix,text) Prepends to text. 'prefix' is prepended to the start of each word in 'text'.
2 – ADDSUFFIX
$(ADDSUFFIX suffix,text) Appends to text. 'suffix' is appended to the end of each word in 'text'.
3 – FILTER
$(FILTER pattern...,text) Filters text. Any word in 'text' that does not match any 'pattern' word is removed. 'pattern' words may contain the wildcard characters * and %.
4 – FILTER-OUT
$(FILTER-OUT pattern...,text) Filters text. Any word in 'text' that matches any 'pattern' word is removed. 'pattern' words may contain the wildcard characters * and %.
5 – FINDSTRING
$(FINDSTRING find,text) String search. If 'find' occurs in 'text', the value is 'find'; otherwise, the value is empty.
6 – FIRSTWORD
$(FIRSTWORD text) Returns the first word in 'text'.
7 – FOREACH
$(FOREACH macro,list,text) Repeatedly expands text. For each word in 'list', 'text' is repeated with the value of 'macro' defined as the word from 'list'.
8 – JOIN
$(JOIN list,text) Concatenates word by word. Each word in 'text' is appended to the corresponding word in 'list' to form a word in the result. When the number of words in 'list' and 'text' are not the same, the remaining words from the longer list are simply appended to the result.
9 – PATSUBST
$(PATSUBST pattern...,to,text) Pattern substitution. Each word in 'text' that matches any 'pattern' word is replaced by 'to'. 'pattern' words may contain the wildcard characters * and %. If 'to' also contains wildcard characters, they will be replaced by the text that matched the wildcard characters in 'pattern'.
10 – SORT
$(SORT text) Sorts text. Words in 'text' are sorted into lexical order; duplicated words are removed.
11 – STRIP
$(STRIP text) White-space compression. Leading and trailing white-space is removed from 'text' and each internal sequence of white-space characters is replaced by a single space.
12 – SUBST
$(SUBST from,to,text) String substitution. Each occurrence of 'from' in 'text' is replaced by 'to'.
13 – WORD
$(WORD n,text) Returns the n'th word from 'text'. 'n' should be in the range 1 to the number of words in the list; when 'n' is not in this range, the result is empty.
14 – WORDS
$(WORDS text) Returns the number of words in 'text'.