converting to proper case

  • Thread starter Thread starter ToddT
  • Start date Start date
T

ToddT

i'm trying to convert names to their proper case (e.g. "todd" ->
"Todd") using the following rountine:

Private Function ConvertToProperCase(ByVal stringValue As String)
As String
Dim ci As New
System.Globalization.CultureInfo("en-US", False)
Dim properCaseValue As String

properCaseValue = stringValue.Replace("'", "' ")
properCaseValue = ci.TextInfo.ToTitleCase(properCaseValue)
properCaseValue = properCaseValue.Replace("' ", "'")

Return properCaseValue
End Function ' ConvertToProperCase()


it works fine except when the name i pass in is all in upper case (it
remains in upper case). anybody know why or what i am doing wrong? thx
in advance.
 
Because you need to drop it all to lowercase firs

mystring.ToLower()

Then it should work.
 
yes, this works. thx.

every other combination of upper case and lower case letters gets
converted correctly. how illogical...
 
Back
Top