Beefy Boxes and Bandwidth Generously Provided by pair Networks vroom
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Capitalize First Letter of Each Word

by halley (Prior)
on Jun 30, 2005 at 11:43 UTC ( [id://471370]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Capitalize First Letter of Each Word

By the way, the problem as stated is fairly simple (as others have demonstrated). However, there are a LOT of patterns which probably shouldn't be capitalized at all, or should have multiple capital letters in a word.
"Bit o' Mint" "Mano y Mano" "Chris diBona" "Scrooge McDuck" "Cruella de Ville" "Jake O'Shaunessy" "Tales from the Crypt" "Sanford and Son Salvage Company"
Many of these cases are handled by what I call "title case." The rules vary from style guide to style guide, but as I learned them,
  • The first word is capitalized, always.
  • The last word is capitalized, always.
  • Each remaining word is capitalized, except
    • prepositions (of, by, from, ...),
    • coordinating conjunctions (and, or),
    • articles (the, a, an),
    • common foreign prepositions, conjunctions, articles.

From there, you can try to "restore" words that fit certain patterns, but you'll probably fail. For example, "MacIntyre" but "Macintosh™." Names do not follow common grammatical or spelling rules; they are individual and a special case. Where possible, take the name's owner's spelling and don't corrupt it into all-caps in the first place.

--
[ e d @ h a l l e y . c c ]

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://471370]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.