3 Jan, 2008 in Programming by

Convert upper case, lower case to Capital Title Upper Case

;

Today I was looking for a simple way to clean up user data for printing on address labels. It turns out not everyone in the world uses correct casing when ordering products online.

It was a minor pet peeve but today finally did something about it.

After testing some Regex.Replace methods, I found the built-in static method:

string System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(string str)

Which converts the specified string to Title Case. This looks good enough to clean up a person’s name, street address and city.

Share on Twitter

No Responses so far | Have Your Say!

Comments are closed.