Write a C# Sharp program to reverse the case (upper->lower, lower->upper) of all the characters of given string
- برمجة سي شارب
- برمجة
- 2021-05-30
- ahmadghneem
الأجوبة
using System;
using System.Linq;
namespace exercises
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Original string: PHP");
Console.WriteLine("After reversing the case of all characters of the said string: " + test("PHP"));
Console.WriteLine("\nOriginal string: JavaScript");
Console.WriteLine("After reversing the case of all characters of the said string: " + test("JavaScript"));
Console.WriteLine("\nOriginal string: Python 3.0");
Console.WriteLine("After reversing the case of all characters of the said string: " + test("Python 3.0"));
}
public static string test(string text)
{
return string.Concat(text.Select(x => char.IsUpper(x) ? char.ToLower(x) : char.ToUpper(x)));
}
}
}
أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال