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

后端 未结 7 2096
礼貌的吻别
礼貌的吻别 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:05

    double value = 3.14159D;
    string v = value.ToString().Replace(",", ".");
    Console.WriteLine(v);
    

    Output: 3.14159

提交回复
热议问题