Delphi 函数参考[15]

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 hiyaolee 的 blog

      例子 <参见format>
      ━━━━━━━━━━━━━━━━━━━━━
      首部 function floattostr(value: extended): string; $[sysutils.pas
      功能 返回浮点数value转换成字符串
      说明 当浮点数大等于1e15将采用科学记数法
      参考 function sysutils.floattotext
      例子 edit1.text := floattostr(now);
      ━━━━━━━━━━━━━━━━━━━━━
      首部 function currtostr(value: currency): string; $[sysutils.pas
      功能 返回货币数value转换成字符串
      说明 货币数只保留四位小数
      参考 function sysutils.floattotext
      例子 edit1.text := currtostr(now);
      ━━━━━━━━━━━━━━━━━━━━━
      首部 function floattocurr(const value: extended): currency; $[sysutils.pas
      功能 返回浮点数value转换成货币数
      说明 如果浮点数value超出范围则将触发异常
      参考 const sysutiles.mincurrency;const sysutiles.maxcurrency
      例子 edit1.text := currtostr(floattocurr(now));
      ━━━━━━━━━━━━━━━━━━━━━
      首部 function floattostrf(value: extended; format: tfloatformat; precision,
      digits: integer): string; $[sysutils.pas
      功能 返回浮点数以指定格式转换成字符串
      说明 precision指定精度;digits指定小数宽度
      参考 function sysutils.floattotext
      例子
      ///////begin floattostrf
      procedure tform1.button1click(sender: tobject);
      begin
      memo1.lines.values['ffgeneral'] := floattostrf(strtofloatdef(edit1.text,
      0),
      ffgeneral, spinedit1.value, spinedit2.value);
      memo1.lines.values['ffexponent'] := floattostrf(strtofloatdef(edit1.text,
      0),
      ffexponent, spinedit1.value, spinedit2.value);
      memo1.lines.values['fffixed'] := floattostrf(strtofloatdef(edit1.text, 0),
      fffixed, spinedit1.value, spinedit2.value);
      memo1.lines.values['ffnumber'] := floattostrf(strtofloatdef(edit1.text,
0),
      ffnumber, spinedit1.value, spinedit2.value);
      memo1.lines.values['ffcurrency'] := floattostrf(strtofloatdef(edit1.text,
      0),
      ffcurrency, spinedit1.value, spinedit2.value);
      end;
      ///////end floattostrf
      ━━━━━━━━━━━━━━━━━━━━━
      首部 function currtostrf(value: currency; format: tfloatformat; digits:
      integer): string; $[sysutils.pas
      功能 返回货币类型以指定格式转换成字符串
      说明 digits指定小数宽度
      参考 function sysutils.floattotext
      例子
      ///////begin currtostrf
      procedure tform1.button1click(sender: tobject);
      begin
      memo1.lines.values['ffgeneral'] := currtostrf(strtocurrdef(edit1.text, 0),
      ffgeneral, spinedit1.value);
      memo1.lines.values['ffexponent'] := currtostrf(strtocurrdef(edit1.text,
0),
      ffexponent, spinedit1.value);
      memo1.lines.values['fffixed'] := currtostrf(strtocurrdef(edit1.text, 0),
      fffixed, spinedit1.value);
      memo1.lines.values['ffnumber'] := currtostrf(strtocurrdef(edit1.text, 0),
      ffnumber, spinedit1.value);
      memo1.lines.values['ffcurrency'] := currtostrf(strtocurrdef(edit1.text,
0),
      ffcurrency, spinedit1.value);
      end;
      ///////end currtostrf
      ━━━━━━━━━━━━━━━━━━━━━
      首部 function floattotext(bufferarg: pchar; const value; valuetype:
      tfloatvalue; format: tfloatformat; precision, digits: integer): integer;
      $[sysutils.pas

本文关键:Delphi 函数参考
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top