Make a uppercase string character to lowercase and vice-versa
Its a program to change a uppercase letter to lowercase and the lower case letter to uppercase.
The input is a string.
static void Main(string[] args)
{
Console.WriteLine(CheckNo("abcdEF"));
Console.ReadLine();
}
public static string CheckNo(string s)
{
StringBuilder sb = new StringBuilder();
Char ch ;
char[] arr1;
char[] c = s.ToCharArray();
for (int i = 0; i < c.Length; i++)
{
if (Char.IsUpper(c[i]))
{
ch = Char.ToLower(c[i]);
}
else
ch = Char.ToUpper(c[i]);
sb.Append(ch.ToString());
}
return sb.ToString();
}
The input is a string.
static void Main(string[] args)
{
Console.WriteLine(CheckNo("abcdEF"));
Console.ReadLine();
}
public static string CheckNo(string s)
{
StringBuilder sb = new StringBuilder();
Char ch ;
char[] arr1;
char[] c = s.ToCharArray();
for (int i = 0; i < c.Length; i++)
{
if (Char.IsUpper(c[i]))
{
ch = Char.ToLower(c[i]);
}
else
ch = Char.ToUpper(c[i]);
sb.Append(ch.ToString());
}
return sb.ToString();
}
Comments
Post a Comment