Results 1 to 5 of 5

Thread: ProperCase

  1. #1

    Thread Starter
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    ProperCase

    Question... I am using the ProperCase to auto fix names entered...
    txt.Text = StrConv(txt.Text, VbStrConv.ProperCase)

    but, on occasion there are names that have multiple capitals like JoAnne or McAllister etc... is there any thing that knows how to deal with these? im guessing no... but thought I would ask to make sure.

    If not, I will put make a checkbox to disable the autofix temporarily so the user can type it in.
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  2. #2
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Posts
    12,398

    Re: ProperCase

    I'd avoid using the System.Microsoft.VisualBasic.StrConv method and instead use the System.Globalization.TextInfo.ToTitleCase method, but that's neither here nor there. In your case, there is no built-in method for handling special names like the ones you've mentioned. You'll have to handle it on a case by case basis(no pun intended).
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | HtmlLessons | CssLessons | Code Tags | Sword of Fury - Jameram

  3. #3
    Frenzied Member Gruff's Avatar
    Join Date
    Jan 2014
    Location
    Scappoose Oregon USA
    Posts
    1,293

    Re: ProperCase

    I agree with dday. Proper Names are ticklish when it comes to capitalization.

    McDonald, MacDonald, and Macdonald are all separate Scottish surnames

    First names are so made up these days anything goes.
    Burn the land and boil the sea
    You can't take the sky from me


    ~T

  4. #4
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    2,024

    Re: ProperCase

    Yep, you'll have to handle per culture for that. Here's an example asp.net app with extension methods that handles Irish names casing.

    Github Project Casing Examples VB
    CodeBank: VB.NET & C#.NET | ASP.NET
    Programming: C# | VB.NET
    Blogs: Personal | Programming
    Projects: GitHub | jsFiddle
    ___________________________________________________________________________________

    Rating someone's post is a way of saying Thanks...

  5. #5
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Posts
    12,398

    Re: ProperCase

    Quote Originally Posted by KGComputers View Post
    Yep, you'll have to handle per culture for that. Here's an example asp.net app with extension methods that handles Irish names casing.

    Github Project Casing Examples VB
    It appears as though the author used RegEx with a MatchEvaluator, I had initially thought doing this as it would be the most concise example, but then I thought that the OP should write it so that it would be specific to his situation. But that does seem that the most logical route to take.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | HtmlLessons | CssLessons | Code Tags | Sword of Fury - Jameram

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width