如何将十进制值转换为单词 [英] how to get decimal values into words
问题描述
我正在使用towords()函数将金额转换为单词
value = 6400
朝向(值,0)
i得到的产量就像六千四百
但我想用小数也是
如果价值如此6400.75然后我需要
六千四百七十一
i am using towords() function to convert amount to words
value=6400
towards(value,0)
i am getting output like "six thousand four hundred "
but i want with decimal also
if value goes like this 6400.75 then i neeed
"six thousand four hundred and seventy paise"
推荐答案
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.
这篇关于如何将十进制值转换为单词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!