Next: , Previous: Evaluation Macros, Up: Programming in M4sugar


8.3.4 Text processing Macros

The following macros may be used to manipulate strings in M4. They are not intended for casual use.

— Macro: m4_re_escape (string)

Backslash-escape all characters in string that are active in regexps.

— Macro: m4_tolower (string)
— Macro: m4_toupper (string)

Return string with letters converted to upper or lower case, respectively.

— Macro: m4_split (string, [regexp])

Split string into an M4 list of elements quoted by `[' and `]', while keeping white space at the beginning and at the end. If regexp is given, use it instead of `[\t ]+' for splitting. If string is empty, the result is an empty list.

— Macro: m4_normalize (string)

Remove leading and trailing spaces and tabs, sequences of backslash-then-newline, and replace multiple spaces and tabs with a single space.

— Macro: m4_append (macro-name, string, [separator])
— Macro: m4_append_uniq (macro-name, string, [separator])

Redefine macro-name to its former contents with separator and string added at the end. If macro-name was undefined before (but not if it was defined but empty), then no separator is added. m4_append can be used to grow strings, and m4_append_uniq to grow strings without duplicating substrings.