Next: Regexp, Previous: Len, Up: Text handling
Searching for substrings is done with index:
Expands to the index of the first occurrence of substring in string. The first character in string has index 0. If substring does not occur in string,
indexexpands to `-1'.The macro
indexis recognized only with parameters.
index(`gnus, gnats, and armadillos', `nat')
=>7
index(`gnus, gnats, and armadillos', `dag')
=>-1
Omitting substring evokes a warning, but still produces output.
index(`abc')
error-->m4:stdin:1: Warning: too few arguments to builtin `index'
=>0