1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
dnl @ ../doc/m4.texinfo:8598: Origin of test
dnl @ expected status: 0
dnl @ extra options:
dnl @ Copyright (C) 2006, 2007, 2008, 2009 Free Software
dnl @ Foundation, Inc.
dnl @ This file is free software; the Free Software Foundation
dnl @ gives unlimited permission to copy and/or distribute it
dnl @ with or without modifications, as long as this notice
dnl @ is preserved.
include(`capitalize2.m4')dnl
define(`active', `act1, ive')dnl
define(`Active', `Act2, Ive')dnl
define(`ACTIVE', `ACT3, IVE')dnl
define(`A', `OOPS')dnl
capitalize(active; `active'; ``active''; ```actIVE''')
dnl @result{}Act1,Ive; Act2, Ive; Active; `Active'
undivert(`capitalize2.m4')dnl
dnl @result{}divert(`-1')
dnl @result{}# upcase(text)
dnl @result{}# downcase(text)
dnl @result{}# capitalize(text)
dnl @result{}# change case of text, improved version
dnl @result{}define(`upcase', `translit(`$*', `a-z', `A-Z')')
dnl @result{}define(`downcase', `translit(`$*', `A-Z', `a-z')')
dnl @result{}define(`_arg1', `$1')
dnl @result{}define(`_to_alt', `changequote(`<<[', `]>>')')
dnl @result{}define(`_from_alt', `changequote(<<[`]>>, <<[']>>)')
dnl @result{}define(`_upcase_alt', `translit(<<[$*]>>, <<[a-z]>>, <<[A-Z]>>)')
dnl @result{}define(`_downcase_alt', `translit(<<[$*]>>, <<[A-Z]>>, <<[a-z]>>)')
dnl @result{}define(`_capitalize_alt',
dnl @result{} `regexp(<<[$1]>>, <<[^\(\w\)\(\w*\)]>>,
dnl @result{} <<[_upcase_alt(<<[<<[\1]>>]>>)_downcase_alt(<<[<<[\2]>>]>>)]>>)')
dnl @result{}define(`capitalize',
dnl @result{} `_arg1(_to_alt()patsubst(<<[<<[$*]>>]>>, <<[\w+]>>,
dnl @result{} _from_alt()`]>>_$0_alt(<<[\&]>>)<<['_to_alt())_from_alt())')
dnl @result{}divert`'dnl
|