Delphi的System.Str - 将数字格式化为字符串

举例:

var
  s: string;
begin
  Str(123, s);
  ShowMessage(s);  {123}

  Str(PI, s);
  ShowMessage(s);  {3.14159265358979E+0000}

  Str(PI:0:2, s);
  ShowMessage(s);  {3.14}

  Str(9.1:1:3, s);
  ShowMessage(s);  {9.100}

  Str(100:5, s);
  ShowMessage('^' + s);  {^  100}
end;
posted @ 2010-10-08 17:38  Max Woods  阅读(540)  评论(0编辑  收藏  举报