m4: Index macro

1 
1 11.2 Searching for substrings
1 =============================
1 
1 Searching for substrings is done with 'index':
1 
1  -- Builtin: index (STRING, SUBSTRING)
1      Expands to the index of the first occurrence of SUBSTRING in
1      STRING.  The first character in STRING has index 0.  If SUBSTRING
1      does not occur in STRING, 'index' expands to '-1'.
1 
1      The macro 'index' is recognized only with parameters.
1 
1      index(`gnus, gnats, and armadillos', `nat')
1      =>7
1      index(`gnus, gnats, and armadillos', `dag')
1      =>-1
1 
1    Omitting SUBSTRING evokes a warning, but still produces output;
1 contrast this with an empty SUBSTRING.
1 
1      index(`abc')
1      error->m4:stdin:1: Warning: too few arguments to builtin `index'
1      =>0
1      index(`abc', `')
1      =>0
1      index(`abc', `b')
1      =>1
1