Formatting Numbers as Strings with Commas in place of Decimals

后端 未结 9 603
离开以前
离开以前 2020-12-03 07:46

I have the following number: 4.3

I\'d like to display this number as 4,3 for some of our European friends.

I was under the impressi

9条回答
  •  甜味超标
    2020-12-03 08:40

    NumberFormatInfo nfi = new NumberFormatInfo();
    nfi.NumberDecimalSeparator = ",";
    nfi.NumberGroupSeparator = ".";
    
    double num = 4.3;
    string ret = num.ToString(nfi);    // 4,3
    

提交回复
热议问题