ex_uc v1.0.1 ExUc.Special

Special conversions.

For conversions where simple formules are not enough the config file will reference using an atom a method of this module.

Summary

Functions

Converts from feet and inches, to feet

Checks if a string is a special feet and inches value

Checks if a string is a special pounds and ounces value

Converts from kilograms to pounds and ounces

Converts from pounds and ounces, to pounds

Converts from meters to feet and inches

Functions

ft_in_to_ft(str)

Converts from feet and inches, to feet.

Returns {VALUE_IN_FEET, “ft”}

Parameters

  • str: String with feet and inches value

Examples

iex>ExUc.Special.ft_in_to_ft("7 ft 6 in")
{7.5, "ft"}
is_feet_and_inches?(str)

Checks if a string is a special feet and inches value.

Returns Boolean

Parameters

  • str: String with values and units.

Examples

iex>ExUc.Special.is_feet_and_inches?("6 ft 2.2 in")
true

iex>ExUc.Special.is_feet_and_inches?("6 ft")
false
is_pounds_and_ounces?(str)

Checks if a string is a special pounds and ounces value

Returns Boolean

Parameters

  • str: String with values and units.

Examples

iex>ExUc.Special.is_pounds_and_ounces?("23 lb 4 oz")
true

iex>ExUc.Special.is_pounds_and_ounces?("12.566 lb")
false
kg_to_lb_oz(kgs)

Converts from kilograms to pounds and ounces

Returns String.t

Parameters

  • value: Numeric value for kilograms.

Examples

iex>ExUc.Special.kg_to_lb_oz(20.15)
"44 lb 6.76 oz"
lb_oz_to_lb(str)

Converts from pounds and ounces, to pounds.

Returns {VALUE_IN_POUNDS, “lb”}

Parameters

  • str: String with pounds and ounces value

Examples

iex>ExUc.Special.lb_oz_to_lb("4 lb 5 oz")
{4.3125, "lb"}
m_to_ft_in(meters)

Converts from meters to feet and inches.

Returns String.t

Parameters

  • meters: Numeric meters value

Examples

iex> ExUc.Special.m_to_ft_in(10.35)
"33 ft 11.5 in"