首部 procedure strdispose(str: pchar); $[sysutils.pas
功能 释放指针字符串str内存资源
说明 如果str为nil则不作任何处理;并且释放空间大小信息
参考 function system.dec;function system.sizeof;function system.freemem
例子 <参见strnew>
━━━━━━━━━━━━━━━━━━━━━
首部 function format(const format: string; const args: array of const): string; $[sysutils.pas
功能 返回按指定方式格式化一个数组常量的字符形式
说明 这个函数是我在delphi中用得最多的函数,现在就列举几个例子给你个直观的理解
"%" [索引 ":"] ["-"] [宽度] ["." 摘要] 类型
format('x=%d', [12]); //'x=12' //最普通
format('x=%3d', [12]); //'x= 12' //指定宽度
format('x=%f', [12.0]); //'x=12.00' //浮点数
format('x=%.3f', [12.0]); //'x=12.000' //指定小数
format('x=%.*f', [5, 12.0]); //'x=12.00000' //动态配置
format('x=%.5d', [12]); //'x=00012' //前面补充0
format('x=%.5x', [12]); //'x=0000c' //十六进制
format('x=%1:d%0:d', [12, 13]); //'x=1312' //使用索引
format('x=%p', [nil]); //'x=00000000' //指针
format('x=%1.1e', [12.0]); //'x=1.2e+001' //科学记数法
format('x=%%', []); //'x=%' //得到"%"
s := format('%s%d', [s, i]); //s := s + strtoint(i); //连接字符串
参考 proceduer sysutils.fmtstr
例子 edit1.text := format(edit2.text, [strtofloatdef(edit.3.text, 0)]);
━━━━━━━━━━━━━━━━━━━━━
首部 procedure fmtstr(var result: string; const format: string; const args: array of const); $[sysutils.pas
功能 按指定方式格式化一个数组常量的字符形式返回
说明 <参见format>
参考 function sysutils.formatbuf;function system.length;function system.setlength
例子 <参见format>
━━━━━━━━━━━━━━━━━━━━━
首部 function strfmt(buffer, format: pchar; const args: array of const): pchar; $[sysutils.pas
功能 返回按指定方式格式化一个数组常量的字符指针形式
说明 如果buffer和format其中只要有一个为nil则返回nil
参考 function sysutils.formatbuf
例子 <参见format>
━━━━━━━━━━━━━━━━━━━━━
首部 function strlfmt(buffer: pchar; maxbuflen: cardinal; format: pchar; const args: array of const): pchar; $[sysutils.pas
功能 返回按指定方式和长度格式化一个数组常量的字符指针形式
说明 strlfmt(vbuffer, 6, '%d12345', [1024]) = '10241';
参考 function sysutils.formatbuf
例子 <参见format>
━━━━━━━━━━━━━━━━━━━━━
首部 function formatbuf(var buffer; buflen: cardinal; const format; fmtlen: cardinal; const args: array of const): cardinal; $[sysutils.pas
功能 返回按指定方式格式化一个数组常量到缓冲区buffer中
说明 <null>
参考 <null>
例子 <参见format>
━━━━━━━━━━━━━━━━━━━━━
首部 function wideformat(const format: widestring; const args: array of const): widestring; $[sysutils.pas
功能 返回按指定方式格式化一个数组常量的多字节字符形式
说明 <null>
参考 procedure sysutils.widefmtstr
例子 <参见format>
━━━━━━━━━━━━━━━━━━━━━
首部 procedure widefmtstr(var result: widestring; const format: widestring; const args: array of const); $[sysutils.pas
功能 按指定方式格式化一个数组常量的多字节字符形式返回
说明 <null>
参考 function sysutils.wideformatbuf
例子 <参见format>
━━━━━━━━━━━━━━━━━━━━━
首部 function wideformatbuf(var buffer; buflen: cardinal; const format; fmtlen: cardinal; const args: array of const): cardinal; $[sysutils.pas
功能 返回按指定方式格式化一个数组常量到缓冲区buffer中
说明 <null>
参考 <null>
例子 <参见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
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器