TextInfo.ToTitleCase()
capitalizes the first character in each token of a string.
If there is no need to maintain Acronym Uppercasing, then you should include ToLower()
.
string s = "JOHN DOE";
s = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(s.ToLower());
// Produces "John Doe"
If CurrentCulture is unavailable, use:
string s = "JOHN DOE";
s = new System.Globalization.CultureInfo("en-US", false).TextInfo.ToTitleCase(s.ToLower());
See the MSDN Link for a detailed description.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…