Code to Convert lower case string to Upper case

Manojjupally
Posted by Manojjupally under C# category on | Points: 40 | Views : 1160
Lower to Upper


public static void StringCaps(string str)
{
int diff = 'A' - 'a';
StringBuilder sb = new StringBuilder();
char ch;
foreach (char letter in str)
{
ch = (char)(letter + diff);
sb.Append(ch);
}
Console.WriteLine(sb.ToString());
}

Comments or Responses

Login to post response