ToTitleCase

using System; using System.Globalization; public static class MyExtensionMethods { public static string ToTitleCase(this string str) { return MyExtensionMethods.ToTitleCase(str, CultureInfo.CurrentCulture); } public static string ToTitleCase(this string str, CultureInfo culture) { if (string.IsNullOrEmpty(str)) { return str; } if (culture == null) { throw new ArgumentNullException("culture"); } return culture.TextInfo.ToTitleCase(str); } }
Simple way to turn some string into title case.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.