将小数转换为英文字符串 [英] Converting a decimal to an English string
本文介绍了将小数转换为英文字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我编写了一个.NET类,该类将小数(货币值)转换为英语可读的字符串.
I have written a .NET class that converts decimal (money values) to an english readable string.
113.25 => 113分和25分.
113.25 => one hundred thirteen and 25 cents.
这是支票上的金额行.该代码已部署并且可以工作,但是我想知道是否有比编写一堆if,switch,整数除法和模数语句更好的方法.我希望有一个更优雅的解决方案,而不是我的168行代码将其磨碎.
It is the amount line on checks. The code is deployed and works, but I was wondering if there was a better approach than writing a bunch of if, switch, integer division, and modulus statements. I was hoping for a more elegant solution rather than my 168 lines of grind it out code.
推荐答案
I believe what you are looking for has been done in every language in Code Golf: Number to Words
这篇关于将小数转换为英文字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文