DEV Community

Discussion on: Daily Challenge #3 - Vowel Counter

Collapse
 
ryanwilldev profile image
Ryan Will • Edited

A solution in Elixir

defmodule VowelCounter do
  @vowels ~r/(a|e|i|o|u)/i
  
  def count(""), do: 0

  def count(string) do
    @vowels 
    |> Regex.scan(string)
    |> Enum.count() 
  end
end