How do I show the number in Gujarati’s native numbers in Windows Forms?

I want to develop Gujarati Windows form applicationusing c#.net. But I have a problem that

1) Calculation of two numbers in Gujarati. I solved this code

public static double ParseValue(string value)
{
    return double.Parse(string.Join("",
        value.Select(c => "+-.".Contains(c)
           ? "" + c: "" + char.GetNumericValue(c)).ToArray()),
        NumberFormatInfo.InvariantInfo);
}

But this code provides me with the meaning of "Eng".

But when two Guajarati are figured out no, I get the output in English. Like this:

 Label1.Text = (ParseValue(TextBox1.Text) + ParseValue(TextBox2.Text)).ToString();

//Output is Like this
// ૩ + ૬ = 9

So how can I get the result in a Gujarati number number.

2) What is the data type for Gujarati's value Microsoft Access? For Numeric, DateTime ETC ..

+4
source share
1 answer

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, .

+6

Source: https://habr.com/ru/post/1626626/


All Articles