When I try to convert a string to a numeric value using Parse or TryParse or Convert.ChangeType, I cannot control the thousands separator as it is defined on the system:
if I enter:
var d = double.Parse("1,234", CultureInfo.CurrentUICulture);
it does not return 1234.
If I want to use the group separator, I must enter:
var d = double.Parse("1,234", NumberStyles.Number, CultureInfo.CurrentUICulture);
This time the result is as follows:
But I do not want to use the thousandth separator, I want to use it only if the system sets it in the globalization settings. Is there a way to find out if a separator is being used (I know that I can read the group separator in CultureInfo.CurrentUICulture.NumberFormat.NumberGroupSeparator)
Cheers Loic
source
share