문제

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?

도움이 되었습니까?

해결책

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;
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top