Various english-centric human wording helper functions.
Summary
Functions
iex> a_or_an("explosion") "an explosion" iex> a_or_an("cart") "a cart"
chicago_number as in the Chicago Style Guide's rule for numbers which is to spell out numbers lower than 100.
Similarly, just trying to avoid heavy dependencies, do this here.
iex> pluralize(1, "cave") "cave" iex> pluralize(3, "cave") "caves"
iex> titleize("mote in god's eye") "Mote in God's Eye"
Functions
iex> a_or_an("explosion") "an explosion" iex> a_or_an("cart") "a cart"
See String.capitalize/1.
chicago_number as in the Chicago Style Guide's rule for numbers which is to spell out numbers lower than 100.
We could use Number.to_word() except that library has heavy dependencies
which are not necessary here.
iex> chicago_number(1) "one" iex> chicago_number(42) "forty-two" iex> chicago_number(120) "120"
Similarly, just trying to avoid heavy dependencies, do this here.
iex> comma_number(-1_234_567) "-1,234,567" iex> comma_number(1_234.50000000000353) "1,234.5" iex> comma_number(-1_234.5000) "-1,234.5" iex> comma_number(134.0) "134"
iex> pluralize(1, "cave") "cave" iex> pluralize(3, "cave") "caves"
iex> titleize("mote in god's eye") "Mote in God's Eye"