English Title Case is extremely complicated. And it is not computable. Period.
The best you can get is a routine that changes all small words according to a list of your preferences. This will still be wrong for all verbal expressions. While an extended list of variants could capture many of these, some would still be impossible to decide without a semantical analysis. Two examples:
- Running on/On Empty
- Working on/On a Building
The latter gets indeed clear from the context; the former is not. There is a clear difference of meaning, but the computer can't decide which is right.
(Somtimes even humans can't. I asked about the first example here a StackExchnge forum and got no acceptable answer..)
Here is a list is replacements I like; but some four-letter words (no pun intended) are personal choices. Also some might argue that all types of numerics, like any, all, few should be capitalized.
This is anything but elegant, in fact it is an embarassement of sorts. But it works for me rather well, so I use it on a regular basis and have fed 100k+ titles through it..:
public string ETC(string title)
{ // english title capitalization
if (title == null) return "";
string s = title.Trim().Replace('`', '\''); // change apo to tick mark
TextInfo UsaTextInfo = new CultureInfo("en-US", false).TextInfo;
s = UsaTextInfo.ToTitleCase(s); // caps for all words
// a list of exceptions one way or the other..
s = s.Replace(" A ", " a ");
s = s.Replace(" also ", " Also ");
s = s.Replace(" An ", " an ");
s = s.Replace(" And ", " and ");
s = s.Replace(" as ", " As ");
s = s.Replace(" At ", " at ");
s = s.Replace(" be ", " Be ");
s = s.Replace(" But ", " But ");
s = s.Replace(" By ", " by ");
s = s.Replace(" For ", " for ");
s = s.Replace(" From ", " from ");
s = s.Replace(" if ", " If ");
s = s.Replace(" In ", " in ");
s = s.Replace(" Into ", " into ");
s = s.Replace(" he ", " He ");
s = s.Replace(" has ", " Has ");
s = s.Replace(" had ", " Had ");
s = s.Replace(" is ", " Is ");
s = s.Replace(" my ", " My ");
s = s.Replace(" ", " "); // no triple spaces
s = s.Replace("'N'", "'n'"); // Rock 'n' Roll
s = s.Replace("'N'", "'n'"); // Rock 'n Roll
s = s.Replace(" no ", " No ");
s = s.Replace(" Nor ", " nor ");
s = s.Replace(" Not ", " not ");
s = s.Replace(" Of ", " of ");
s = s.Replace(" Off ", " off ");
s = s.Replace(" On ", " on ");
s = s.Replace(" Onto ", " onto ");
s = s.Replace(" Or ", " or ");
s = s.Replace(" O'c ", " O'C ");
s = s.Replace(" Over ", " over ");
s = s.Replace(" so ", " So ");
s = s.Replace(" To ", " to ");
s = s.Replace(" that ", " That ");
s = s.Replace(" this ", " This ");
s = s.Replace(" thus ", " Thus ");
s = s.Replace(" The ", " the ");
s = s.Replace(" Too ", " too ");
s = s.Replace(" when ", " When ");
s = s.Replace(" With ", " with ");
s = s.Replace(" Up ", " up ");
s = s.Replace(" Yet ", " yet ");
// a few(!) verbal expressions
s = s.Replace(" Get up ", " Get Up ");
s = s.Replace(" Give up ", " Give Up ");
s = s.Replace(" Givin' up ", " Givin' Up ");
s = s.Replace(" Grow up ", " Grow Up ");
s = s.Replace(" Hung up ", " Hung Up ");
s = s.Replace(" Make up ", " Make Up ");
s = s.Replace(" Wake Me up ", " Wake Me Up ");
s = s.Replace(" Mixed up ", " Mixed Up ");
s = s.Replace(" Shut up ", " Shut Up ");
s = s.Replace(" Stand up ", " Stand Up ");
s = s.Replace(" Wind up ", " Wind Up ");
s = s.Replace(" Wake up ", " Wake Up ");
s = s.Replace(" Come up ", " Come Up ");
s = s.Replace(" Working on ", " Working On ");
s = s.Replace(" Waiting on ", " Waiting On ");
s = s.Replace(" Turn on ", " Turn On ");
s = s.Replace(" Move on ", " Move On ");
s = s.Replace(" Keep on ", " Keep On ");
s = s.Replace(" Bring It on ", " Bring It On ");
s = s.Replace(" Hold on ", " Hold On ");
s = s.Replace(" Hang on ", " Hang On ");
s = s.Replace(" Go on ", " Go On ");
s = s.Replace(" Coming on ", " Coming On ");
s = s.Replace(" Come on ", " Come On ");
s = s.Replace(" Call on ", " Call On ");
s = s.Replace(" Trust in ", " Trust In ");
s = s.Replace(" Fell in ", " Fell In ");
s = s.Replace(" Falling in ", " Falling In ");
s = s.Replace(" Fall in ", " Fall In ");
s = s.Replace(" Faith in ", " Faith In ");
s = s.Replace(" Come in ", " Come In ");
s = s.Replace(" Believe in ", " Believe In ");
return s.Trim();
}
Note that there are still quite a few rules that can't be implemented like this.
Some basic rules are not so hard: Capitalize the 1st and last word. All verbs (Is), adjectives (Red), promouns (He), nouns (Ace) and numbers (One), even if they have less than 3 (or 4) letters.
But the Exceptions are hard, e.g.: Don't capitalize prepositions when they are part or a verbal expression...
Example 1: 'Working on/On a Building' - You have to know that it is a gospel song to decide that it is 'On'.
Example 2: 'Running On/on Empty'. Could mean 'Running On' or 'Running (with gas indictor) 'on Empty'.
So in the end you will have to live with a compromise.