Jun 8, 2012

Change Text to Proper Case in C#

This is a flash blog Smile with tongue out, real fast. Wonder how to change a text to Proper Case? If you don’t know what is Proper Case (or in another words is Title Case), here it is the quote from Wikipedia.

“Some computer programming languages offer facilities for converting text to a form in which all words are first-letter capitalized.” from Wikipedia.

Proper Case Code
  1. string Input = "pIetER wALSh";
  2. string Output = System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(Input);
  3. /*
  4. * The result for Output = "Pieter Walsh"
  5. */

Hope it helps…. Winking smile