1、

Math.Round(0.333333,2); //按照四舍五入的国际标准
  2、

double dbdata=0.335333;
string str1=String.Format("{0:F}",dbdata);//默认为保留两位
  3、

float i=0.333333;
int j=(int)(i * 100);
i = j/100;
  4、

decimal.Round(decimal.Parse("0.3333333"),2)
  5、

private System.Globalization.NumberFormatInfo nfi = new System.Globalization.NumberFormatInfo();
float test=0.333333f;
nfi.NumberDecimalDigits=2;
string result=test.ToString("N", nfi);
  6、   

string result= String.Format("{0:N2}",Convert.ToDecimal("0.333333").ToString());

本文来自CSDN博客:http://blog.csdn.net/mallva/archive/2008/01/05/2026705.aspx

相关文章:

  • 2021-11-16
  • 2022-02-27
  • 2021-11-18
  • 2022-01-13
  • 2021-06-28
猜你喜欢
  • 2021-05-24
  • 2022-12-23
  • 2021-06-07
  • 2022-12-23
  • 2021-11-28
  • 2021-10-29
相关资源
相似解决方案