Response.Write("<td>"+Odr["price"]+"</td>");
显示为88.00000000
怎样让它变成88
或者还要变成88.00

解决方案 »

  1.   

    Response.Write("<td>"+Odr["price"].substring(0,2)+Odr["price"].sustring(Odr["price"].indexof("."),2)+"</td>");
      

  2.   

    Response.Write("<td>"+Odr["price"].substring(0,2)+Odr["price"].sustring(Odr["price"].indexof("."),3)+"</td>");
      

  3.   

    格式化字符串 用 string.Format
      

  4.   

    ->88
    String.Format("{0:F0}",Convert.ToDouble(Odr["price"]));
    ->88.00
    String.Format("{0:F2}",Convert.ToDouble(Odr["price"]));
      

  5.   

    greennetboy(我的老婆叫静静)
    正解
      

  6.   

    greennetboy(我的老婆叫静静),,是对的.....还可以这样:
    format((double)price,"#00.00");这样返回的结果即为小数点后面有两位
    form((double)price,"#00");这样没有小数位