This package converts numbers to its written form.
intToWords : Basics.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"
roundToWords : Basics.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 : Basics.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 : Basics.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"