Converting double to string with N decimals, dot as decimal separator, and no thousand separator

后端 未结 7 2010
礼貌的吻别
礼貌的吻别 2020-12-28 11:43

I need to convert a decimal to a string with N decimals (two or four) and NO thousand separator:

\'XXXXXXX (dot) DDDDD\'

The problem with CultureInfo.I

相关标签:
7条回答
  • 2020-12-28 12:29

    You can simply use decimal.ToString()

    For two decimals

    myDecimal.ToString("0.00");
    

    For four decimals

    myDecimal.ToString("0.0000");
    

    This gives dot as decimal separator, and no thousand separator regardless of culture.

    0 讨论(0)
提交回复
热议问题