german-sysadmin
This commit is contained in:
17
elixir/german-sysadmin/lib/username.ex
Normal file
17
elixir/german-sysadmin/lib/username.ex
Normal file
@@ -0,0 +1,17 @@
|
||||
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
|
||||
Reference in New Issue
Block a user