converting to proper case

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ToddT

    #1

    converting to proper case

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

    Private Function ConvertToProper Case(ByVal stringValue As String)
    As String
    Dim ci As New
    System.Globaliz ation.CultureIn fo("en-US", False)
    Dim properCaseValue As String

    properCaseValue = stringValue.Rep lace("'", "' ")
    properCaseValue = ci.TextInfo.ToT itleCase(proper CaseValue)
    properCaseValue = properCaseValue .Replace("' ", "'")

    Return properCaseValue
    End Function ' ConvertToProper Case()


    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.

  • Jason

    #2
    RE: converting to proper case

    Because you need to drop it all to lowercase firs

    mystring.ToLowe r()

    Then it should work.

    Comment

    • ToddT

      #3
      Re: converting to proper case

      yes, this works. thx.

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


      On Wed, 5 May 2004 22:36:02 -0700, "Jason"
      <anonymous@disc ussions.microso ft.com> wrote:
      [color=blue]
      >Because you need to drop it all to lowercase first
      >
      >mystring.ToLow er();
      >
      >Then it should work.[/color]

      Comment

      Working...