[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Change "WORD" to "Word"



Please, let's drop it.  It is not MacPerl related, and even if it were, it
has dragged on too long.  :)

Not the list mom,

--Chris

At 14.02 1/8/98, Brian L. Matthews wrote:
>|>|>I'm trying to change words that are in all upercase to upper and lower.
>|>|I've noticed a lot of solutions to this problem already, but none looks
>|>|as simple as mine. So here goes:
>|>|     s/(\w+)/\u\L$1/g;
>|>That capitalizes the first letter of *every* word. You have to look for
>|>an uppercase letter at the start of the word:
>|>s/\b([A-Z]\w+)/\L\u$1\E/g;
>|You want to apply the substitution to the whole sentence, not just the
>|names?
>
>As I recall the original article, and from private communication with
>the original querier, and from the text quoted above, the original
>request was to take a chunk of text, and modify the case of words that
>are in all uppercase. The second substitution above does that, the
>first doesn't.
>
>|Still, I think it's simpler to change the case to lower case for every
>|letter in a word but leaving the first as it was.
>|       s/(\w)(\w+)/$1\L$2/g;
>
>Which also fails in the case you criticize s/\b([A-Z]\w+)/\L\u$1\E/g
>for failing: "pHILADELPHIA" becomes "philadelphia". s/(\w)(\w+)/$1\L$2/g
>also screws up properly cased words like "MacDonalds".
>
>This doesn't have anything to do specifically with MacPerl, so I suggest
>further discussion take place in comp.lang.perl.misc.
>
>Brian
>
>***** Want to unsubscribe from this list?
>***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch