Sha256: e29f9ff5e6be3ce8ee46ba7409e1736a947fea91442dbef5e9d9571d990f91bd

Contents?: true

Size: 349 Bytes

Versions: 69

Compression:

Stored size: 349 Bytes

Contents

defmodule Isogram do
  @doc """
  Determines if a word or sentence is an isogram
  """
  @spec isogram?(String.t()) :: boolean
  def isogram?(sentence) do
    codepoints =
      sentence
      |> String.downcase()
      |> String.replace(~r/\s|-/u, "")
      |> String.codepoints()

    length(Enum.uniq(codepoints)) == length(codepoints)
  end
end

Version data entries

69 entries across 69 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/elixir/exercises/isogram/example.exs
trackler-2.2.1.179 tracks/elixir/exercises/isogram/example.exs
trackler-2.2.1.178 tracks/elixir/exercises/isogram/example.exs
trackler-2.2.1.177 tracks/elixir/exercises/isogram/example.exs
trackler-2.2.1.176 tracks/elixir/exercises/isogram/example.exs
trackler-2.2.1.175 tracks/elixir/exercises/isogram/example.exs
trackler-2.2.1.174 tracks/elixir/exercises/isogram/example.exs
trackler-2.2.1.173 tracks/elixir/exercises/isogram/example.exs
trackler-2.2.1.172 tracks/elixir/exercises/isogram/example.exs
trackler-2.2.1.171 tracks/elixir/exercises/isogram/example.exs
trackler-2.2.1.170 tracks/elixir/exercises/isogram/example.exs
trackler-2.2.1.169 tracks/elixir/exercises/isogram/example.exs
trackler-2.2.1.167 tracks/elixir/exercises/isogram/example.exs
trackler-2.2.1.166 tracks/elixir/exercises/isogram/example.exs
trackler-2.2.1.165 tracks/elixir/exercises/isogram/example.exs
trackler-2.2.1.164 tracks/elixir/exercises/isogram/example.exs
trackler-2.2.1.163 tracks/elixir/exercises/isogram/example.exs
trackler-2.2.1.162 tracks/elixir/exercises/isogram/example.exs
trackler-2.2.1.161 tracks/elixir/exercises/isogram/example.exs
trackler-2.2.1.160 tracks/elixir/exercises/isogram/example.exs