(m4.info.gz) Substr
Info Catalog
(m4.info.gz) Regexp
(m4.info.gz) Text handling
(m4.info.gz) Translit
10.4 Extracting substrings
==========================
Substrings are extracted with `substr':
-- Builtin: substr (STRING, FROM, [LENGTH])
Expands to the substring of STRING, which starts at index FROM,
and extends for LENGTH characters, or to the end of STRING, if
LENGTH is omitted. The starting index of a string is always 0.
The expansion is empty if there is an error parsing FROM or
LENGTH, if FROM is beyond the end of STRING, or if LENGTH is
negative.
The macro `substr' is recognized only with parameters.
substr(`gnus, gnats, and armadillos', `6')
=>gnats, and armadillos
substr(`gnus, gnats, and armadillos', `6', `5')
=>gnats
Omitting FROM evokes a warning, but still produces output.
substr(`abc')
error-->m4:stdin:1: Warning: too few arguments to builtin `substr'
=>abc
substr(`abc',)
error-->m4:stdin:2: empty string treated as 0 in builtin `substr'
=>abc
Info Catalog
(m4.info.gz) Regexp
(m4.info.gz) Text handling
(m4.info.gz) Translit
automatically generated byinfo2html