Exflect (exflect v0.1.0)
Summary
Functions
Inflects the input word based on the the integer given.
Pluralizes an English word. $ Exflect.pluralize("leaf") => "leaves"
Singlarizes an English word. $ Exflect.singularize("leaves") => "leaf"
Functions
inflect(word, n, opts \\ [match_style: false])
@spec inflect(String.t(), pos_integer(), keyword()) :: String.t()
Inflects the input word based on the the integer given.
$ Exflect.inflect("leaf", 0) => "leaves" $ Exflect.inflect("leaf", 1) => "leaf" $ Exflect.inflect("leaf", 2) => "leaves"
Also accepts the match_style
option
pluralize(word, opts \\ [match_style: false])
Pluralizes an English word. $ Exflect.pluralize("leaf") => "leaves"
Takes the option match_style
if you want it to maintain the current whitespace/case.
$ Exflect.pluralize(" LEAF ", match_style: true) => " LEAVES "
singularize(text, opts \\ [match_style: false])
Singlarizes an English word. $ Exflect.singularize("leaves") => "leaf"
Takes the option match_style
if you want it to maintain the current whitespace/case.
$ Exflect.singularize(" LEAVES ", match_style: true) => " LEAF "