Convert numbers into words in pure MoonBit (EN/FR/ES/DE/IT/PT/PT_PT/RU): cardinal, ordinal, ordinal_num, year, and currency.
import "668xin/num2words-moonbit" @n2w
@n2w.num2words_int(1234, "en", "cardinal") // "one thousand, two hundred and thirty-four"
@n2w.num2words_int(2024, "en", "year") // "twenty twenty-four"
@n2w.num2words_str("1234.56", "en", "cardinal") // "one thousand, two hundred and thirty-four point five six"
@n2w.num2words_int(1000, "ru", "cardinal") // "одна тысяча"
@n2w.num2words_currency("1234.56", "en", "EUR")
// Ok("one thousand, two hundred and thirty-four euro, fifty-six cents")fn is_valid_number(s : String) -> Boolfn num2words_float(value : Double, lang : String, to : String) -> Stringfn num2words_int(value : Int, lang : String, to : String) -> Stringfn num2words_str(value : String, lang : String, to : String) -> StringInstall
Download zipConvert numbers into words in pure MoonBit (EN/FR/ES/DE/IT/PT/PT_PT/RU): cardinal, ordinal, ordinal_num, year, and currency.