Answer to Question #283253 in C# for kani

Question #283253

Write a program to delete all vowels present in a string in c#


1
Expert's answer
2021-12-28T10:03:43-0500

This code

  1. Reads a string from console input
  2. Creates regular expression (Regex) object with vowels pattern and case ignoring
  3. Writes string where vowels replaced with empty string to console output
using System;
using System.Text.RegularExpressions;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            var vowelRegex = new Regex(@"[a|e|i|o|u]", RegexOptions.IgnoreCase | RegexOptions.Compiled);
            Console.WriteLine(vowelRegex.Replace(s, ""));
        }
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS