数字到文本转换 [英] Numeric to text conversion

查看:73
本文介绍了数字到文本转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找到了将数字转换为文本的代码,但它显示错误的结果1000000十万和所有十万分之一的值。任何人都可以帮我纠正这段代码。

I have find this code of converting numeric to text but it displays wrong result for 1000000 ten lakh and for all lakh values. Can anybody help me to correct this code.

展开 | 选择 | Wrap | 行号

推荐答案

我查了一下,脚本工作正常,输出是标准的英文数字。你可能没有意识到术语十字架。仅在印度使用,我甚至不确定它的含义。一位印度朋友曾经告诉过我这意味着什么,(可能是1000万?)但它不是标准的英语。如果您希望脚本使用与标准不同的规则,则需要为其制定规则。


给出一个数字的例子以及如何读取输出,我们将看看我们是否可以提出使用lakh的程序逻辑


Jared
I checked it and the script worked just fine, the outputs are standard English numbers. You may not realize that the term "lakh" is only used in India and I''m not even sure what it means. An Indian friend once told me what it meant, (10 million maybe?) but it is not standard English. If you want the script to use different rules than the standard you will need to come up with the rules for it.

Give an example of a number and how the output should be read and we will see if we can come up with the program logic for using "lakh"

Jared


嗨jhardman,感谢您的关注,但由于我在印度网站上工作,我必须显示lac或lakh值。我会告诉你我们如何计算,例如,如果你有一个数字3287649,那么我们会用三十二万八十七数千六百四十九。但正如我发现上面写的代码不能显示十字架,即使我声明十字架它显示错误的值。所以,任何人都可以帮我纠正上面的代码或帮我找到一些符合我要求的其他代码。
hi jhardman, thanks for your concern but as i am working on an Indian site I have to display lac or lakh values. i''ll tell you how we count for example if you have a number 3287649 then we count in words like " Thirty two lakh Eighty Seven thousand Six hundred and fourty nine". But as i have find the code written above cannot display lakh even though i declare lakh it displays wrong values. So, can anyone help me to correct the above code or help me to find some other code that suits my requirement.



hi jhardman,感谢您的关注,但当我在印度网站上工作时,我必须显示紫胶或十万分之一的值。我会告诉你我们如何计算,例如,如果你有一个数字3287649,那么我们会用三十二万八十七数千六百四十九。但正如我发现上面写的代码不能显示十字架,即使我声明十字架它显示错误的值。那么,任何人都可以帮我纠正上面的代码或帮助我找到一些适合我的要求的其他代码。
hi jhardman, thanks for your concern but as i am working on an Indian site I have to display lac or lakh values. i''ll tell you how we count for example if you have a number 3287649 then we count in words like " Thirty two lakh Eighty Seven thousand Six hundred and fourty nine". But as i have find the code written above cannot display lakh even though i declare lakh it displays wrong values. So, can anyone help me to correct the above code or help me to find some other code that suits my requirement.



标准英语规则遵循一个非常简单的模式:每三个数字你需要一个新的分隔符。您给出的代码使用此模式显示单词。印度方法不遵循这种模式,因此您要么必须从头开始重新设计此代码,要么输入一些逻辑语句来确定何时放入lakh。试图宣布十字架是不行的。在列表中。


从你的例子我看到lakh意思是十万,但我不知道足以帮助你定义模式。当你继续使用像百万和十亿这样更高的数字时,你还会使用十万吗?您怎么说328 764 933?


Jared

The standard English rules follow a very simple pattern: every three digits you need a new separator. The code you gave uses this pattern to display the words. The Indian method doesn''t follow that pattern, so you are either going to have to re-design this code from scratch, or throw in some logical statements to determine when you would put in the "lakh". It will not work to try to just declare "lakh" in the list.

From your example I see that "lakh" means "one hundred thousand", but I don''t know enough to help you define the pattern. Do you still use lakh when going on to higher numbers like million and billion? How would you say 328 764 933?

Jared


这篇关于数字到文本转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆