Wednesday, September 6, 2017

a slightly better way of casting a string to Pascal Case in C#

CultureInfo is now just statically available in the System.Globalization namespace in C#. You don't have to fish it off the thread as suggested here. Instead you may just do something like:

TextInfo textInfo = CultureInfo.CurrentCulture.TextInfo;
string Tom = textInfo.ToTitleCase("tom");

No comments:

Post a Comment