DEV Community

loading...

Discussion on: Daily Challenge #148 - Disemvowel Trolls

Collapse
andreasjakof profile image
Andreas Jakof

In C#

public static readonly List<Char> LowerCaseVowels = new List<Char> {'a', 'e', 'i', 'o', 'u'};

public static bool IsLowerCaseVowel(this char c) => LowerCaseVowels.Contains(c);

public static string RemoveVowels(string input) =>
    new string(input.Where(c => !c.ToLowerInvariant().IsLowerCaseVowel()));
Collapse
praneetnadkar profile image
Praneet Nadkar

Or may be just

var cleaned = Regex.Replace(input,"[aeiou]", "", RegexOptions.IgnoreCase);

Collapse
andreasjakof profile image