Skip to content

Instantly share code, notes, and snippets.

@Harrisonl
Last active November 24, 2016 09:44
Show Gist options
  • Save Harrisonl/a5be825f78d2e6598cafa5c806efeec2 to your computer and use it in GitHub Desktop.
Save Harrisonl/a5be825f78d2e6598cafa5c806efeec2 to your computer and use it in GitHub Desktop.
defmodule Binary do
def strip_vowels(a,b \\ "")
def strip_vowels("", acc), do: acc
def strip_vowels(<<"a", rest::binary>>, acc), do: strip_vowels(rest, acc)
def strip_vowels(<<"e", rest::binary>>, acc), do: strip_vowels(rest, acc)
def strip_vowels(<<"i", rest::binary>>, acc), do: strip_vowels(rest, acc)
def strip_vowels(<<"o", rest::binary>>, acc), do: strip_vowels(rest, acc)
def strip_vowels(<<"u", rest::binary>>, acc), do: strip_vowels(rest, acc)
def strip_vowels(<<head::binary-size(1), rest::binary>>, acc), do: strip_vowels(rest, acc <> head)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment