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

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




In a message dated 1/6/98 6:33:29 PM, ken@nondo.com wrote:

<<I'm trying to change words that are in all upercase to upper and lower.
And i can'rt seem to come up with a logical way to achieve this.

Here's my problem... I'm writing a script for our sports section to
process the NBA boxscores for publication.

Far too often AP sends words in the file in all uppercase and we change
them. For example: L.A. LAKERS, PHILADELPHIA, SAN ANTONIO. Iturned
everythig to lowercase with "tr" But now I can't seem to come up with a
search that will only change the first letter of a word.

Any ideas?

I've been trying, in a while statement, to change every lowercase char
that isn't preceded by another lowercase char or uppercase char to
uppercase. (Since the first letter of each word would be at the begining
of the string or preceded by a space, comma or period.  I figured that
would work, but I end up changing every char. to uppercase.

Any help would be greatly appreciated. Thanks.>>

ken@nondo.com:

There are four case conversion functions in Perl.

1. The lc function, which converts a string to lowercase
2. The uc function, which converts a string to uppercase
3. The lcfirst function, which converts the first character of a string to
lowercase
4. The ucfirst function, which converts the first character of a string to
uppercase

Could you somehow use the ucfirst function?  Hope this helps.

Will Merrill
WAMerrill@aol.com


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