Skip to content

Instantly share code, notes, and snippets.

@maxclaus
Last active December 17, 2015 22:49
Show Gist options
  • Save maxclaus/5685316 to your computer and use it in GitHub Desktop.
Save maxclaus/5685316 to your computer and use it in GitHub Desktop.
Capitalise just the first letter of the whole sentence
private string Capitalise(string str)
{
if(String.IsNullOrEmpty(str))
return string.Empty;
var firstLetter = string.Empty;
if(str.Length > 0)
firstLetter = Char.ToUpper(str[0]);
return (str.Length == 1) ? firstLetter : firstLetter + str.Substring(1).ToLower();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment