enkidatron/elm-cldr/2.4.0

NOTE: the latest version is 3.2.1

Cldr.Format.Number

Number Formatting

format : FormatType -> Locale -> Float -> String

Formats a Float using the specified Locale.

import Cldr.Locale exposing (en)


format Decimal en 123456789
--> "123,456,789"
round : Decimals -> FormatType -> Locale -> Float -> String

Rounds and formats a Float using the specified Locale.

import Cldr.Format.Number as Number
import Cldr.Locale exposing (en)
import FormatNumber.Locales exposing (Decimals(..))


Number.round (Exact 1) Decimal en 123456789
--> "123,456,789.0"

Format Type

= Decimal
| Currency CurrencyCode
| Percent

Numbers can be formatted as decimals, currency, or percentages.

A CurrencyCode is just a String.