In this example,I’ll show you How to make Make lower case upper and upper case lower in a string in C#.
C# Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
static void Main(string[] args) { Console.Write("Word : "); string word =Console.ReadLine(); string output = ""; foreach (char c in word) { if (Char.IsUpper(c)) output += Char.ToLower(c); else output += Char.ToUpper(c); } Console.WriteLine("Output: "+output); Console.ReadLine(); } |