如何在C#Windows应用程序中总结古吉拉特语值 [英] How Can I Sum In Gujarati Value In C# Windows Application

查看:76
本文介绍了如何在C#Windows应用程序中总结古吉拉特语值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在C#Windows应用程序中加入古吉拉特语数字。



示例:2000 + 2000 = 4000

古吉拉特语。

解决方案

首先,古吉拉特语数字采用Unicode代码点0AE6到0AEF的范围,并且与传统的Westen阿拉伯数字0到9具有相同的顺序: http://unicode.org/charts/PDF/U0A80.pdf [ ^ ]。



因此,你可以,例如,从阿拉伯语转换为古吉拉特语并使用简单的班次返回。要从.NET char获取代码点,您可以使用以下函数:

https://msdn.microsoft.com/en-us/library/z2ys180b%28v=vs.110%29.aspx [ ^ ],

https://msdn.microsoft.com/en- us / library / system.char.convertfromutf32%28v = vs.110%29.aspx [ ^ ]。



现在,我建议以下场景:不要尝试对这些字符串进行数值运算。相反,开发两种方法:将古吉拉特语数解析为您感兴趣的数字类型(例如, int long 并将该数字表示为古吉拉特语数字串。换句话说,创建两个类似于 int.Parse (或 int.TryParse )的函数的Gujarati版本和 int.ToString 。完成后,您可以将字符串解析为数字,在数字中进行加法(减法,乘法),然后将数字表示为字符串。



-SA

How can i Sum in Gujarati numbers in C# Windows application.

Example: ૨૦૦૦ + ૨૦૦૦ = ૪૦૦૦
in gujarati sum.

解决方案

First of all, Gujarati digits take the range of Unicode code points 0AE6 to 0AEF and have the same order than traditional Westen Arabic digits 0 to 9: http://unicode.org/charts/PDF/U0A80.pdf[^].

Therefore, you can, for example, convert from Arabic to Gujarati and back using a simple shift. To get a code point from .NET char, you can use these functions:
https://msdn.microsoft.com/en-us/library/z2ys180b%28v=vs.110%29.aspx[^],
https://msdn.microsoft.com/en-us/library/system.char.convertfromutf32%28v=vs.110%29.aspx[^].

Now, I advise the following scenario: don't try to do numeric arithmetic on those strings. Instead, develop two methods: parsing a Gujarati number into the numeric type your are interested in (say, int or long) and representing the number as a Gujarati numeral string. In other words, create two "Gujarati versions" of functions analogous to int.Parse (or int.TryParse) and int.ToString. When it's done, you can parse strings to number, do your addition (subtraction, multiplication) in numbers and then represent numbers as strings.

—SA


这篇关于如何在C#Windows应用程序中总结古吉拉特语值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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