如何将很多小数点只保留二位,比如:0.45667->0.45,不用copy,急,在线等

解决方案 »

  1.   

    he following table shows some sample formats and the results produced when the formats are applied to different values:FormatFloatFormat string- 1234 -1234 0.5 0
    1234 -1234 0.5 0
    0 1234 -1234 1 0
    0.00  1234.00 -1234.00 0.50 0.00
    #.##   1234 -1234 .5
    #,##0.00 1,234.00 -1,234.00 0.50 0.00
    #,##0.00;(#,##0.00) 1,234.00 (1,234.00) 0.50 0.00
    #,##0.00;;Zero  1,234.00 -1,234.00 0.50 Zero
    0.000E+00    1.234E+03 -1.234E+03 5.000E-01 0.000E+00
    #.###E-0   1.234E3 -1.234E3 5E-1 0E0
      

  2.   

    Format('x=%.3f', [12.0]); //'x=12.000' //指定小数
      

  3.   

    result:= round(value * 100) / 100;
      

  4.   

    formatfloat()或先乘100取整,然所再除100就可以了。
      

  5.   

    procedure TForm1.Button1Click(Sender: TObject);beginedit1.Text :=floattostr(int(0.45667*100)/100);
    end;