Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re^2: Regex Typecase

by halley (Prior)
on Aug 14, 2007 at 14:39 UTC ( #632508=note: print w/replies, xml ) Need Help??

in reply to Re: Regex Typecase
in thread Regex Typecase

The library rules for title case are even more complicated than that. I learned that you capitalize the first and last words, even if they ARE prepositions or articles. You're right in that the edge cases like apostrophes and multiple capitals (e.g., "McDonald's") are annoyingly complicated to get right.

For my website, I have a "turn filenames into titles" function. For example, a-sunrise-to-remember.jpg becomes "A Sunrise to Remember" which uses a small canned list of the most common prepositions and articles (including a few in Spanish). Every once in a while, I find I have to add yet another special case.

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

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://632508]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2022-12-02 13:27 GMT
Find Nodes?
    Voting Booth?