Slug-elixir

Run Settings
LanguageElixir
Language Version
Run Command
defmodule Slug do def create_slug(str) do str |> String.trim |> String.downcase |> remove_accents |> String.replace(~r/[^a-z0-9]+/, "-") |> String.trim("-") end defp remove_accents(str) do str |> String.normalize(:nfd) |> String.replace(~r/[\x{0300}-\x{036f}]/u, "") end end IO.puts Slug.create_slug("Jak psát nadpisy?") IO.puts Slug.create_slug("Příliš žluťoučký kůň úpěl ďábelské ódy") # Výstup: prilis-zlutoucky-kun-upel-dabelske-ody
Editor Settings
Theme
Key bindings
Full width
Lines