By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,669 Members | 1,634 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,669 IT Pros & Developers. It's quick & easy.

Why does ToTitleCase not work if the case is already in upper case?

P: n/a
Why does ToTitleCase not work if the case is already in upper case?

I have to make my string lowercase, first, before I pass to to
ToTitleCase to have it work.

Titan

Apr 15 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
titan nyquist wrote:
Why does ToTitleCase not work if the case is already in upper case?

I have to make my string lowercase, first, before I pass to to
ToTitleCase to have it work.

Titan
That is the way that the function is supposed to work:

"Generally, title casing converts the first character of a word to
uppercase and the rest of the characters to lowercase. However, a word
that is entirely uppercase, such as an acronym, is not converted."

--
Göran Andersson
_____
http://www.guffa.com
Apr 15 '07 #2

P: n/a
On Sun, 15 Apr 2007 16:17:37 -0700, titan nyquist
<ti***********@gmail.comwrote:
Why does ToTitleCase not work if the case is already in upper case?
So that acronyms and abbreviations are not incorrectly converted to lower
case, as the documentation explains.
I have to make my string lowercase, first, before I pass to to
ToTitleCase to have it work.
If you know that the string is all upper-case, this is probably a fine
solution. Beware, however, of accidently converting to lower-case letters
that should be upper-case.

Pete
Apr 15 '07 #3

P: n/a
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.

Titan.

Apr 16 '07 #4

P: n/a
On Sun, 15 Apr 2007 16:57:44 -0700, titan nyquist
<ti***********@gmail.comwrote:
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
Apr 16 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.