carmonw/elm-number-to-words/1.0.2

NOTE: the latest version is 1.0.3

NumberToWords

This package converts numbers to its written form.

Int to String

intToWords : Int -> String

Convert an Int to its written form.

import NumberToWords


NumberToWords.intToWords 1255
--> "one thousand, two hundred fifty-five"


NumberToWords.intToWords 1232551
--> "one million, two hundred thirty-two thousand, five hundred fifty-one"

Float to String

roundToWords : Float -> String

Convert a Float to its written form after rounding it to the nearest integer.

import NumberToWords


NumberToWords.roundToWords 1255.20
--> "one thousand, two hundred fifty-five"


NumberToWords.roundToWords 1232551.50
--> "one million, two hundred thirty-two thousand, five hundred fifty-two"
floorToWords : Float -> String

Convert a Float to its written form after rounding it down.

import NumberToWords


NumberToWords.floorToWords 1255.20
--> "one thousand, two hundred fifty-five"


NumberToWords.floorToWords 1232551.20
--> "one million, two hundred thirty-two thousand, five hundred fifty-one"
ceilingToWords : Float -> String

Convert a Float to its written form after rounding it up.

import NumberToWords


NumberToWords.ceilingToWords 1255.20
--> "one thousand, two hundred fifty-six"


NumberToWords.ceilingToWords 1232551.20
--> "one million, two hundred thirty-two thousand, five hundred fifty-two"