如何将文字金额转换为数字
我正在寻找 ac# 函数,它将单词中的金额转换为相对数字。
例如,一千二十五应转换为 1025。
感谢任何人的早期帮助。
I am looking for a c# function which converts amount in words to relative number.
For an example, one thousand twenty five should be converted to 1025.
Early help of anyone is appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
检查下面的链接,它是用 Python 编写的,但您可以查看逻辑是否有用。
问候
有没有办法将数字单词转换为整数?
Check the link bellow, its Written in Python but you can see the logic if its useful or not.
Regards
Is there a way to convert number words to Integers?
Marc Burns 的 ruby gem 可以做到这一点。我最近分叉了它以增加多年来的支持。您可以从 C# 调用 ruby 代码。
There's a ruby gem by Marc Burns that does it. I recently forked it to add support for years. You can call ruby code from C#.
已经测试它可以处理包含多个数字的字符串。
用法:
findNumbers("成本为 529,326 美元 23 美分");
输出:"成本为 529326 美元 23 美分"
Have tested it to work on strings containing multiple numbers.
Usage:
findNumbers("The cost is five hundred twenty nine thousand three hundred and twenty six dollars and twenty three cents");
Output: "The cost is 529326 dollars and 23 cents"