我想Gujarati
Windows form application
使用开发c#.net
。但我有问题
1)在古吉拉特语中计算两个数。我通过这段代码解决了
public static double ParseValue(string value)
{
return double.Parse(string.Join("",
value.Select(c => "+-.".Contains(c)
? "" + c: "" + char.GetNumericValue(c)).ToArray()),
NumberFormatInfo.InvariantInfo);
}
但是此代码为我提供了工程数值。
但是当计算两个Guajarati no时,我得到英语输出。像这样:
Label1.Text = (ParseValue(TextBox1.Text) + ParseValue(TextBox2.Text)).ToString();
//Output is Like this
// ૩ + ૬ = 9
所以我怎么能得到古吉拉特语数字输出
2)古吉拉特语值的数据类型是什么Microsoft Access
?对于数字,DateTime ETC ..
您可以使用NumberFormat
属性CultureInfo
来查找有关区域性数字格式的信息,包括:
然后,您可以使用此信息将您的号码转换为本机格式。
例如:
public string GetNativeRepresentation(double value)
{
var format = CultureInfo.GetCultureInfo("gu-IN").NumberFormat;
return String.Join("", value.ToString(CultureInfo.InvariantCulture)
.Select(x =>
{
if ("1234567890".Contains(x.ToString()))
return format.NativeDigits[x - '0'];
else if (x == '-')
return format.NegativeSign;
else if (x == '.')
return format.NumberDecimalSeparator;
else
return x.ToString();
}));
}
例如:
MessageBox.Show(GetNativeRepresentation(-1234567890.123));
显示:
-૧૨૩૪૫૬૭૮૯૦.૧૨૩
最好是每种类型的独立文化保存,例如,使用规范化的语言类型,如int
,double
和DateTime
,然后在使用.NET Framework的本地化机制的运用,显示本地化的值的版本。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句