Title Case Method

9 views
Skip to first unread message

AJ Robertson

unread,
Aug 27, 2014, 10:48:04 AM8/27/14
to pdxruby-...@googlegroups.com
I was just recently writing a method that correctly title cases a string. My issue is, what about nouns that are less than 4 letters? For example, in most word processors, you type the nouns tom, jim, ed, pat, etc. and the word processor suggests capitalizing those words. To support this kind of functionality do you have to include some sort of word dictionary or is there a different way of doing it? 

I noticed that http://www.smashingmagazine.com/ just capitalizes every word in their titles ignoring the word's size and grammar altogether. Is this was most development teams do to avoid the headache of proper title casing? 

Thanks,
AJ

Rico Jones

unread,
Aug 28, 2014, 4:00:58 PM8/28/14
to pdxruby-...@googlegroups.com
What rules, exactly, are you trying to follow. My instinct is that maybe it's better to create a list of words you don't capitalize and just capitalize everything else.

Hanna Liebl

unread,
Aug 28, 2014, 5:14:38 PM8/28/14
to pdxruby-...@googlegroups.com
I agree. There's a site that does this with JavaScript, you can see that script here: http://individed.com/code/to-title-case/js/to-title-case.js and I think it does it in the same way.


--
You received this message because you are subscribed to the Google Groups "pdxruby-beginners" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pdxruby-beginn...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages