C# - Remove all vowels from a string

I am coding a C# application where the user can specify a name and the program will return the name without the vowels. But how does the program understand that if the name contains A, E, I, O, U, Y, then the letters shall be removed.

Just remove all the vowels (same for upper case) and assign it to the name again:

string vowels = "aeiouy";
string name = "Some Name with vowels";
name = new string(name.Where(c => !vowels.Contains(c)).ToArray());

Mirror from

StackOverflow - Remove all vowels from a name - stackoverflow.com/questions/5676733/remove-all-vowels-from-a-name/

Previous Post Next Post