We have code in our system to format numbers and currency according to the regional settings selected by the user. One of our users has selected en-ZA and noticed that the digit grouping and decimal separators have changed with our migration to .NET 4.0.
I wrote a snippet of code to illustrate this change:
using System;
namespace regional
{
class Program
{
static void Main(string[] args)
{
var ci = new System.Globalization.CultureInfo("en-ZA");
var output = 1234567.00m.ToString("c", ci);
Console.WriteLine(output);
}
}
}
Under .NET 3.5, we get output that looks like this:
R 1,234,567.00
Under .NET 4.0, we get output that looks like this:
R 1 234 567,00
What accounts for the change in decimal separator and digit grouping between .NET 3.5 and .NET 4.0?
According to Wikipedia, "When South Africa adopted the metric system, it adopted the comma as its decimal separator." This implies that this setting changed at some point, but I still don't have insight as to why the behavior is different between the different framework versions.