Skip to content

Instantly share code, notes, and snippets.

@gte445e
Created April 8, 2018 17:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gte445e/8983bb557b633b705558e89ac065fa80 to your computer and use it in GitHub Desktop.
Save gte445e/8983bb557b633b705558e89ac065fa80 to your computer and use it in GitHub Desktop.
Title Case String extension
using System.Globalization;
using System.Threading;
namespace System
{
public static class StringExtensions
{
public static string ToTitleCase(this string value)
{
if (value == null) return null;
CultureInfo cultureInfo = Thread.CurrentThread.CurrentCulture;
TextInfo textInfo = cultureInfo.TextInfo;
return textInfo.ToTitleCase(value.ToLower());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment