f77coder has asked for the wisdom of the Perl Monks concerning the following question:
old C-style macros in headers files are #ifdef __some_Long_name__ which start and end with double underlines and look like perl literals
in C++14, i'd like to batch convert these macros to standard which strips the double underscores and convert strings to upper case like this
SOME_LONG_NAME
i like one-liners, so i've tried these and many variations to escaping the underscores
thanksperl -pi -e 's/__*__/\uc($1)/g' a.test; perl -pi -e 's/__*__/\U$1/g' a.test
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: another string replacement with uppercase :: converting C macros to C++
by Athanasius (Cardinal) on Jan 23, 2016 at 08:30 UTC | |
by martin (Friar) on Jan 23, 2016 at 09:06 UTC | |
by Athanasius (Cardinal) on Jan 23, 2016 at 09:21 UTC | |
by choroba (Cardinal) on Jan 23, 2016 at 09:18 UTC | |
by f77coder (Beadle) on Jan 23, 2016 at 08:36 UTC | |
|
Re: another string replacement with uppercase :: converting C macros to C++
by AnomalousMonk (Archbishop) on Jan 23, 2016 at 18:09 UTC |