CVSROOT: /sources/m4 Module name: m4 Branch: branch-1_4 Changes by: Eric Blake <ericb> 07/10/02 22:07:23
Index: examples/capitalize.m4 =================================================================== RCS file: /sources/m4/m4/examples/capitalize.m4,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.1.2.1 diff -u -b -r1.1.1.1 -r1.1.1.1.2.1 --- examples/capitalize.m4 17 Feb 2000 03:03:19 -0000 1.1.1.1 +++ examples/capitalize.m4 2 Oct 2007 22:07:23 -0000 1.1.1.1.2.1 @@ -1,8 +1,12 @@ -dnl -dnl convert to upper- resp. lowercase +divert(`-1') +# upcase(text) +# downcase(text) +# capitalize(text) +# change case of text, simple version define(`upcase', `translit(`$*', `a-z', `A-Z')') define(`downcase', `translit(`$*', `A-Z', `a-z')') -dnl -dnl capitalize a single word -define(`capitalize1', `regexp(`$1', `^\(\w\)\(\w*\)', `upcase(`\1')`'downcase(`\2')')') -define(`capitalize', `patsubst(`$1', `\w+', ``'capitalize1(`\0')')') +define(`_capitalize', + `regexp(`$1', `^\(\w\)\(\w*\)', + `upcase(`\1')`'downcase(`\2')')') +define(`capitalize', `patsubst(`$1', `\w+', `_$0(`\&')')') +divert`'dnl
