Thanks. That makes it tough... as some of my strings are all UPPER
CASE when they shouldn't be. It's hard to differentiate between what
should be made title case and what shouldn't.
Yup. A strictly typographical algorithm is going to need human
intervention to avoid doing it wrong at least some of the time, since
human languages don't encode that information when letter case is absent.
Alternatively, you could just accept that the results are going to be
wrong some of the time and implement the solution in a way that gets it
right the greatest amount of time (so if you know, for example, that you
get strings that are all upper case much more often than you get strings
that have acronyms or other abbreviations in them, you can go ahead and do
what you're doing).
Other than that, you could of course apply some sort of dictionary
approach, where you convert the string to lower case one word at a time
and actually look at the words in the string to see whether it's safe to
convert them to lower case or not. This is much more complicated, of
course, especially if performance is an issue. But it would have the
advantage of being more accurate.
It just depends on how important it is to get it right 100% of the time.
Pete