exercism/elixir/german-sysadmin/lib/username.ex

18 lines
328 B
Elixir
Raw Normal View History

2023-12-18 13:05:47 +00:00
defmodule Username do
def sanitize([]), do: []
def sanitize([first | other]) do
sanitized =
case first do
-> ~c"ae"
-> ~c"oe"
-> ~c"ue"
-> ~c"ss"
ok when ok in ?a..?z or ok == ?_ -> [ok]
_ -> []
end
sanitized ++ sanitize(other)
end
end