Skip to content

Instantly share code, notes, and snippets.

@maxcnunes
Last active December 17, 2015 22:49
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 maxcnunes/5685316 to your computer and use it in GitHub Desktop.
Save maxcnunes/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