Formatting Numbers as Strings with Commas in place of Decimals

后端 未结 9 602
离开以前
离开以前 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:36

    Use a CultureInfo that has commas instead of decimal point (French for instance) :

    string.Format(CultureInfo.GetCultureInfo("fr-FR"), "{0:0.0}", 4.3);
    

提交回复
热议问题