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;

相关文章:

  • 2021-12-14
  • 2022-12-23
  • 2022-12-23
  • 2021-10-24
  • 2022-12-23
  • 2021-09-12
  • 2021-06-25
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-04-09
  • 2021-11-17
  • 2021-12-08
相关资源
相似解决方案