ToTitleCase() doesn't work for upper case strings

T

Tim_Mac

hi,
i'm referring to System.Globalization.TextInfo.ToTitleCase(string s)
and it works fine if you pass in an all lower or mixed case string.
however i am trying to make amends for data entry staff who like to
leave Caps Lock on all the time, so all the input is in upper case.
ToTitleCase("CORK") returns "CORK" instead of "Cork".

any ideas why? i can obviously sent all the strings ToLower before
calling ToTitleCase but that seems like a hack.

i read the unicode technical report that the case-mapping is based on
and based on the specification, it should convert the first letter to a
capital letter (if it has a mapping) and all subsequent letters in the
word to lower case.

thanks for any help
tim
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

If you read the docs it clearly says that in an uppercase word it makes no
changes. basically cause he does not know if it's a name, what would happen
with MSDN , OS, XML and the rest of others acronism used?
 
T

Tim_Mac

hi ignacio
you are right, i just checked the 2.0 documentation and they make it
clear about the upper case exception. however the 1.1 docs i was
originally reading make no mention of it.
thanks for pointing this out.
tim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top