18 lines
328 B
Elixir
18 lines
328 B
Elixir
|
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
|