Hi,
I wrote this code to put the number as decimal (for example 125 300 255,00). But I would like to have this number separated like this 125.300.255,00. But its doesnt put dot between number as I want. Please let see my code:
C#
double d1, d2, total;
double.TryParse(number1.Text, out d1);
double.TryParse(number2.Text, out d2);
total = d1 - d2;
finalResult.Text = total.ToString("N2"); //Need the final result here pleaseThank you,
Israel.
IsraelRank #1,223 · 1.5K pointsPosted Jul 26, 2018, 10:34 AM EDT
double d1, d2, total; double.TryParse(number1.Text, out d1); double.TryParse(number2.Text, out d2); total = d1 - d2; finalResult.Text = total.ToString("N2"); //Need the final result here please finalResult.Text = string.Format(System.Globalization.CultureInfo.GetCultureInfo("id-ID"), "{0:#,##0.00}", double.Parse(finalResult.Text));Rafnas T PRank #280 · 8.8K pointsPosted Jul 26, 2018, 8:47 PM EDT
if you want to do that, then you can do as a string, if in a string space is there then replace those spces with decimal point as per you ex, string nomber = "125 300 255,00"; string dotednomber = nomber.Replace(" ",".");