且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将十进制值转换为单词

更新时间:2023-02-11 08:26:15

HI,



如下所示。



try like below.
Towords(truncate(6400.75), 0) + " Rupees and " + towords(abs(100 * (truncate(6400.75)- 6400.75)), 0) + "Paise";



结果是:六千四百卢比和七十五paise



第一部分即


result is: six thousand four hundred Rupees and seventy five paise

The first part i.e.

Towords(truncate(6400.75), 0) 



返回6400,并将忽略小数位。



第二部分即


returns 6400, and will ignore the decimal place.

Second part i.e.

(abs(100 * (6400.75 - truncate(6400.75))



将其转换为正值并将该值乘以非小数。



如果您有更多小数位,则必须调整100乘数。



希望它有所帮助。


converts it to a positive value and multiplies the value to be non decimal.

If you have more decimal places you''ll have to adjust the 100 multiplier.

hope it helps.