thesis v0.0.29 Thesis.Utilities
Module that provides helper functions.
Summary
Functions
Takes a URL and strips unnecessary characters
Removes special characters, keeps dashes and underscores, and replaces spaces with dashes. Also downcases the entire string
Generates a random string of letters of a given length
Generates a random string of digits of a given length
Functions
Takes a URL and strips unnecessary characters.
iex> import Thesis.Utilities
iex> normalize_url("http://infinite.red//ignite//foo")
"http://infinite.red/ignite/foo"
iex> normalize_url("https://infinite.red/ignite/foo/")
"https://infinite.red/ignite/foo"
Removes special characters, keeps dashes and underscores, and replaces spaces with dashes. Also downcases the entire string.
iex> import Thesis.Utilities
iex> parameterize("Jamon is so cool!")
"jamon-is-so-cool"
iex> parameterize("%#d50SDF dfsJ FDS lkdsf f dfka a")
"d50sdf-dfsj-fds--lkdsf-f-dfka---a"
Generates a random string of letters of a given length.
iex> import Thesis.Utilities
iex> String.length(random_string(15))
15
iex> random_string(15) != random_string(15)
true