Closed quan-nh2 closed 3 years ago
Thanks for the issue. The Rules Based Number Formats (RBNF) are not always complete for floating point numbers for all locales and there isn't an easy way to introspect the rules either.
However for the "en" locale, the ruleset :spellout_cardinal
does implement floating point support. So for example:
iex> Cldr.Number.to_string 1234.4, format: :spellout_cardinal, locale: "en"
{:ok, "one thousand two hundred thirty-four point four"}
# Just notices that this format was not in the `Cldr.Number.to_string/3` api
# So I have added it and it will be published in the next version in April with
# CLDR 39 data.
iex> Cldr.Number.to_string 1234.4, format: :spellout_cardinal_verbose, locale: "en"
{:ok, "one thousand two hundred and thirty-four point four"}
Hopefully this fulfils your immediate need - please let me know if not!
So great! Thanks for your support!
Code:
Could you support convert from float numbers to words in the future? Thank you!