格式化输出函数:FormatFloat

var
  s: string;
begin
  //FormatFloat 的参数1是 String 格式指令, 参数2是实数类型 Extended

  s := FormatFloat('###.###',12.3456);
  //返回: 12.346
  s := FormatFloat('000.000',12.3456);
  //返回: 012.346

  s := FormatFloat('#.###',12.3);
  //返回: 12.3
  s := FormatFloat('0.000',12.3);
  //返回: 12.300

  s := FormatFloat('#,#.#',1234567);
  //返回: 1,234,567
  s := FormatFloat('0,0.0',1234567);
  //返回: 1,234,567.0

  s := FormatFloat('0.00E+0',1234567);
  //返回: 1.23E+6
  s := FormatFloat('0.00E+00',1234567);
  //返回: 1.23E+06

  //在科学计数法中使用 # 好像不合适?

  ShowMessage(s);
end;
原文地址:https://www.cnblogs.com/Bung/p/2365063.html