Crutches.Integer
Summary↑
multiple_of?(n, divisor) | Check whether the integer is evenly divisible by the argument |
ordinal(n) | Return just the ordinal of a number (“st”, “nd”, “rd”, “th”) |
ordinalize(n) | Return the number and it’s ordinal as a string |
Types ↑
s :: String
i :: Integer
Functions
Check whether the integer is evenly divisible by the argument.
Examples
iex> Integer.multiple_of?(7, 3)
false
iex> Integer.multiple_of?(10, 2)
true
iex> Integer.multiple_of?(14, 7)
true
Specs:
Return just the ordinal of a number (“st”, “nd”, “rd”, “th”)
Examples
iex> Integer.ordinal(-1)
"st"
iex> Integer.ordinal(174)
"th"
iex> Integer.ordinal(0)
"th"
iex> Integer.ordinal(-23)
"rd"
Specs:
Return the number and it’s ordinal as a string
Examples
iex> Integer.ordinalize(2)
"2nd"
iex> Integer.ordinalize(276)
"276th"
iex> Integer.ordinalize(-8)
"-8th"