C# Sharp Exercises: Remove all vowels from a given string.
C# Sharp Basic: Exercise-83 with Solution
Write a C# Sharp program to remove all vowels from a given string.
Sample Solution:
C# Sharp Code:
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, "");
}
}
}
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
Flowchart:
C# Sharp Code Editor:
Improve this sample solution and post your code through Disqus
Previous: Write a C# Sharp program to remove all characters which are non-letters from a given string.
Next: Write a C# Sharp program to get the index number of all lower case letters in a given string.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework