回在指针字符串Str搜索字符Chr最后一个出现的地址 说明 没有找到则返回空指针 参考 <NULL> 例子 Edit2.Text := StrRScan(PChar(Edit1.Text), ''''*''''); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrPos(const Str1, Str2: PChar): PChar; $[SysUtils.pas 功能 返回指针字符串Str2在Str1中第一个出现的地址 说明 没有找到则返回空指针;StrPos(''''12345'''', ''''3'''') = ''''345'''' 参考 <NULL> 例子 Edit3.Text := StrPos(PChar(Edit1.Text), PChar(Edit2.Text)); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrUpper(Str: PChar): PChar; $[SysUtils.pas 功能 返回指针字符串Str大写 说明 非小写字符不处理 参考 <NULL> 例子 Edit1.Text := StrUpper(PChar(Edit2.Text)); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrLower(Str: PChar): PChar; $[SysUtils.pas 功能 返回指针字符串Str小写 说明 非大写字符不处理 参考 <NULL> 例子 Edit1.Text := StrLower(PChar(Edit2.Text)); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrPas(const Str: PChar): string; $[SysUtils.pas 功能 返回指针字符串Str转换成字符串 说明 也可以直接赋值 参考 <NULL> 例子 Edit1.Text := StrPas(PChar(Edit2.Text)); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrAlloc(Size: Cardinal): PChar; $[SysUtils.pas 功能 返回分配指定空间的内存资源给指针字符串 说明 空间的大小也将保存;用StrDispose才能全部释放 参考 function System.GetMem 例子 ///////Begin StrAlloc procedure TForm1.Button1Click(Sender: TObject); var P: PChar; begin P := StrAlloc(SpinEdit1.Value); ShowMessage(IntToStr(StrLen(P))); Dec(P, SizeOf(Cardinal)); ShowMessage(IntToStr(Cardinal(Pointer(P)^))); Inc(P, SizeOf(Cardinal)); StrDispose(P); end; ///////End StrAlloc
━━━━━━━━━━━━━━━━━━━━━ 首部 function StrBufSize(const Str: PChar): Cardinal; $[SysUtils.pas 功能 返回通过函数StrAlloc分配的缓冲区大小 说明 出现异常情况则返回不可预知的结果 参考 function System.SizeOf 例子 SpinEdit1.Value := StrBufSize(StrAlloc(SpinEdit2.Value)); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrNew(const Str: PChar): PChar; $[SysUtils.pas 功能 返回复制一个新的指针字符串 说明 如果Str为nil则返回nil 参考 function SysUtils.StrLen;function SysUtils.StrMove;function SysUtils.StrAlloc 例子 ///////Begin StrNew,StrDispose procedure TForm1.Button1Click(Sender: TObject); var P: PChar; begin P := StrNew(PChar(Edit1.Text)); ShowMessage(P); StrDispose(P); end; ///////End StrNew,StrDispose ━━━━━━━━━━━━━━━━━━━━━ 首部 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, ''''%d|12345'''', [1024]) = ''''1024|1''''; 参考 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> ━━━━━━━━━━━━━━━━━━━━━ &nbs 上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] ... 下一页 >> [系统软件]InstallShield Express for delphi制作安装程序定… [常用软件]InstallShield Express制作Delphi数据库安装程序 [Delphi程序]为什么选择Delphi.Net ? [Delphi程序]《关于VisiBroker For Delphi的使用》(4) [Delphi程序]Delphi 程序员代码编写标准指南 [Delphi程序]转贴:Conversion to Delphi 6: Missing unit Pro… [Delphi程序]Borland Delphi 9 的新特性 [Delphi程序]Delphi 键盘码表 [Delphi程序]Chuck Jazdzewski的离开意味着Delphi的终结吗? [Delphi程序]Delphi Access violations 问题的解决之道
|