Cldr.Unit.Parser.canonical_unit_name-exclamation-mark

You're seeing just the function canonical_unit_name-exclamation-mark, go back to Cldr.Unit.Parser module for more information.
Link to this function

canonical_unit_name!(unit_string)

View Source

Returns the canonical unit name for a unit or raises on error

Arguments

  • unit_string is any string representing a unit such as light_year_per_week.

Returns

  • {:ok, canonical_name} or

  • raises an exception

Examples

iex> Cldr.Unit.Parser.canonical_unit_name! "meter"
:meter

iex> Cldr.Unit.Parser.canonical_unit_name! "meter meter"
:square_meter

iex> Cldr.Unit.Parser.canonical_unit_name! "meter per kilogram"
"meter_per_kilogram"

iex> Cldr.Unit.Parser.canonical_unit_name! "meter kilogram"
"kilogram_meter"

=> Cldr.Unit.Parser.canonical_unit_name! "meter kilogram per fluxom"
** (CaseClauseError) no case clause matching: {:error,
    {Cldr.UnknownUnitError, "Unknown unit was detected at "fluxom""}}