ToTitleCase - Making text Title Case

Whilst returning some data from LDAP, I found that it was returning in Upper Case, I needed it to be in Title case format.

I found this method of converting to title case

Title Case converts every first letter of a word in a sentence to upper case, and the rest to lower case.

Of course you could always use Regex....

using System.Globalization;
using System.Threading;

//Create CultureInfo and TextInfo classes to use ToTitleCase method
CultureInfo cultureInfo = Thread.CurrentThread.CurrentCulture;
TextInfo textInfo = cultureInfo.TextInfo;

ClientName = textInfo.ToTitleCase(txtClientName.Text);

Author Danny Mehmed


phayman said:

Good Find!!!

02/Feb/2009 19:16 PM

Add Comment


Your comment has been received and will be shown once it passes moderation.