0

When exporting some data to an Excel workbook I am setting a custom number format for certain fields.

The problem is that the actual format string depends on the locale, for example "0.00" for English and "0,00" for Slovenian.

Is there any way to read the decimal delimiter from regional settings?

Jan B. Kjeldsen
  • 17,817
  • 5
  • 32
  • 50
Mrki
  • 368
  • 2
  • 7
  • We usually go the other way around here, and change the options in our Excel workbooks to the standard US format. – ian_scho Jul 05 '12 at 14:52
  • Local (Slo) users want to have the comma, so I don't think I have a choice here. – Mrki Jul 23 '12 at 13:53

1 Answers1

2
public static str currencyDecimalSeparator()
{
    System.Threading.Thread               t = System.Threading.Thread::get_CurrentThread();
    System.Globalization.CultureInfo      ci = t.get_CurrentCulture();
    System.Globalization.NumberFormatInfo ni;
    str                                   delimiter;

    ci.ClearCachedData();
    ni = ci.get_NumberFormat();

    delimiter = ni.get_CurrencyDecimalSeparator();

    return delimiter;
}
Allan Iversen
  • 536
  • 5
  • 5