","image":"http://www.luping.net/uploads/20240730/172233432966a8bc79e1c0f.jpg","datePublished":"2024-07-30T18:12:09+08:00","dateModified":"2024-07-30T18:12:09+08:00","author":{"@type":"Person","name":"luping.net","url":"https://www.luping.net/articlelist/0_1.html"}}
(This is a repost from my abandoned tumblr blog; dated 2016-11-17)
A client requested that we spell out numbers on their website in order to clarify some financial totals. I initially planned on using the ColdFusion NumberAsString UDF from 2002. After reviewing the results, I thought it was worth a unit test comparison to review the results against ICU4J (java).
In the end, I decided to use ICU4J because:
123 = "one hundred twenty-three" 100001 = "one hundred thousand one" 9 = "nine" 64578.25 = "sixty-four thousand five hundred seventy-eight point two five" 0.333 = "zero point three three three"
Here's the CFML source code:
https://gist.github.com/JamoCA/cd343524e417f382d5c706954e52dfaf
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3