Connecting Tech Pros Worldwide Help | Site Map

ToTitleCase() doesn't work for upper case strings

Tim_Mac
Guest
 
Posts: n/a
#1: Aug 3 '06
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

Ignacio Machin \( .NET/ C# MVP \)
Guest
 
Posts: n/a
#2: Aug 3 '06

re: ToTitleCase() doesn't work for upper case strings


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?


--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Tim_Mac" <mackey.tim@gmail.comwrote in message
news:1154612564.322636.325380@m73g2000cwd.googlegr oups.com...
Quote:
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
>

Tim_Mac
Guest
 
Posts: n/a
#3: Aug 3 '06

re: ToTitleCase() doesn't work for upper case strings


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

Closed Thread