Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Capitalize First Letter of Each Word

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


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
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (2)
As of 2024-04-24 17:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found