how to convert uppercase to lowercase and lowercase to uppercase of given string using c#
Here I am solving the problem using C# programming language
static class Program
{
static void Main(string[] args)
{
CaseConvertion("Coder Juggernaut Blog");
}
public static void CaseConvertion(string input)
{
string newString = "";
foreach (char item in input)
{
if (char.IsLower(item))
{
string upper = item.ToString().ToUpper();
newString = newString + upper;
}
else if (char.IsUpper(item))
{
string lower = item.ToString().ToLower();
newString = newString + lower;
}
else
{
newString = newString + " ";
}
}
Console.WriteLine("Conerted Name : {0} ", newString);
Console.ReadLine();
}
}
0 comments: