Sunday, June 2, 2013

Capitalize each word in sentence using C#

For non-English cultures, change the TextInfo parameter.

public static string SentenceCase(string phrase)
{
   TextInfo textInfo = new CultureInfo("en-US", false).TextInfo;
   string capitalized = textInfo.ToTitleCase(phrase);

   return phrase;
}

No comments:

Can't RDP? How to enable / disable virtual machine firewall for Azure VM

Oh no!  I accidentally blocked the RDP port on an Azure virtual machine which resulted in not being able to log into the VM anymore.  I did ...