Q:

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

0

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

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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, "");
        }
    }
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now