Write a C# Sharp program to remove all vowels from a given string

  • برمجة سي شارب
  • برمجة

Write a C# Sharp program to remove all vowels from a given string

Sample Output:

Orginal string: Python
After removing all the vowels from the said string: Pythn

Orginal string: C Sharp
After removing all the vowels from the said string: C Shrp

Orginal string: JavaScript
After removing all the vowels from the said string: JvScrpt

الأجوبة

using System;
using System.Text.RegularExpressions;

namespace exercises
{
    class Program
    {
        static void Main(string[] args)
          {
            string text;
            text = "Python";
            Console.WriteLine("Orginal string: "+text);
            Console.WriteLine("After removing all the vowels from the said string: " + test(text));
            text = "C Sharp";
            Console.WriteLine("\nOrginal string: " + text);
            Console.WriteLine("After removing all the vowels from the said string: " + test(text));
            text = "JavaScript";
            Console.WriteLine("\nOrginal string: " + text);
            Console.WriteLine("After removing all the vowels from the said string: " + test(text));
        }

        public static string test(string text)
        {
            return new Regex(@"[aeiouAEIOU]").Replace(text, "");
        }
    }
}
هل كان المحتوى مفيد؟

تبحث عن مدرس اونلاين؟

محتاج مساعدة باختيار المدرس الافضل؟ تواصل مع فريقنا الان لمساعدتك بتأمين افضل مدرس
ماهو التخصص الذي تبحث عنه؟
اكتب هنا...