<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<title><![CDATA[缘份天空 - Delphi编程]]></title>
<link>http://www.zjidea.com/blog/</link>
<description><![CDATA[记录我生活与工作中的点滴]]></description>
<language>zh-cn</language>
<copyright><![CDATA[Copyright 2005 PBlog3 v2.8]]></copyright>
<webMaster><![CDATA[lzq0323@yahoo.com.cn(相逢萍水)]]></webMaster>
<generator>PBlog2 v2.4</generator> 
<image>
	<title>缘份天空</title>
	<url>http://www.zjidea.com/blog/images/logos.gif</url>
	<link>http://www.zjidea.com/blog/</link>
	<description>缘份天空</description>
</image>

			<item>
			<link>http://www.zjidea.com/blog/article/delphi/20091211_delphi_function4.htm</link>
			<title><![CDATA[Delphi函数大全4]]></title>
			<author>lzq0323@yahoo.com.cn(相逢萍水)</author>
			<category><![CDATA[Delphi编程]]></category>
			<pubDate>Fri,11 Dec 2009 13:15:06 +0800</pubDate>
			<guid>http://www.zjidea.com/blog/default.asp?id=459</guid>
		<description><![CDATA[首部&nbsp;&nbsp;function TryStrToDate(const S: string; out Value: TDateTime): Boolean; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回字符串S转换成日期Value是否成功<br/>说明&nbsp;&nbsp;字符非日期表达时返回False并且Value将输出为0<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子<br/>///////Begin TryStrToDate<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>var<br/>&nbsp;&nbsp;vDateTime: TDateTime;<br/>begin<br/>&nbsp;&nbsp;CheckBox1.Checked := TryStrToDate(Edit1.Text, vDateTime);<br/>&nbsp;&nbsp;DateTimePicker1.Date := vDateTime;<br/>end;<br/>///////End TryStrToDate<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function StrToTime(const S: string): TDateTime; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回字符串S转换成时间<br/>说明&nbsp;&nbsp;字符非时间表达时将引起异常<br/>参考&nbsp;&nbsp;function SysUtils.TryStrToTime<br/>例子&nbsp;&nbsp;DateTimePicker1.Time := StrToTime(Edit1.Text);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function StrToTimeDef(const S: string; const Default: TDateTime): TDateTime; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回字符串S转换成时间<br/>说明&nbsp;&nbsp;字符非时间表达时则返回默认值Default<br/>参考&nbsp;&nbsp;function SysUtils.TryStrToTime<br/>例子&nbsp;&nbsp;DateTimePicker1.Time := StrToTimeDef(Edit1.Text, Time);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function TryStrToTime(const S: string; out Value: TDateTime): Boolean; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回字符串S转换成时间Value是否成功<br/>说明&nbsp;&nbsp;字符非时间表达时返回False并且Value将输出为0<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子<br/>///////Begin TryStrToTime<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>var<br/>&nbsp;&nbsp;vDateTime: TDateTime;<br/>begin<br/>&nbsp;&nbsp;CheckBox1.Checked := TryStrToTime(Edit1.Text, vDateTime);<br/>&nbsp;&nbsp;DateTimePicker1.Time := vDateTime;<br/>end;<br/>///////End TryStrToTime<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function StrToDateTime(const S: string): TDateTime; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回字符串S转换成日期时间<br/>说明&nbsp;&nbsp;字符非日期时间表达时将引起异常<br/>参考&nbsp;&nbsp;function SysUtils.TryStrToDateTime<br/>例子&nbsp;&nbsp;Edit1.Text := DateTimeToStr(StrToDateTime(Edit2.Text));<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function StrToDateTimeDef(const S: string; const Default: TDateTime): TDateTime; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回字符串S转换成日期时间<br/>说明&nbsp;&nbsp;字符非日期时间表达时则返回默认值Default<br/>参考&nbsp;&nbsp;function SysUtils.TryStrToDateTime<br/>例子&nbsp;&nbsp;Edit1.Text := DateTimeToStr(StrToDateTimeDef(Edit2.Text, Now));<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function TryStrToDateTime(const S: string; out Value: TDateTime): Boolean; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回字符串S转换成日期时间Value是否成功<br/>说明&nbsp;&nbsp;字符非日期时间表达时返回False并且Value将输出为0<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子<br/>///////Begin TryStrToDateTime<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>var<br/>&nbsp;&nbsp;vDateTime: TDateTime;<br/>begin<br/>&nbsp;&nbsp;CheckBox1.Checked := TryStrToDateTime(Edit1.Text, vDateTime);<br/>&nbsp;&nbsp;Edit2.Text := DateTimeToStr(vDateTime);<br/>end;<br/>///////End TryStrToDateTime<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function FormatDateTime(const Format: string; DateTime: TDateTime): string; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回用指定的格式Format来格式化日期时间DateTime<br/>说明&nbsp;&nbsp;FormatDateTime(&#39;YYYY&#34;年&#34;MM&#34;月&#34;DD&#34;日&#34;&#39;, StrToDate(&#39;2002-03-09&#39;)) = &#39;2002年03月09日&#39;<br/>参考&nbsp;&nbsp;function SysUtils.DateTimeToString<br/>例子&nbsp;&nbsp;Edit2.Text := FormatDateTime(Edit1.Text, Now);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;procedure DateTimeToString(var Result: string; const Format: string; DateTime: TDateTime); $[SysUtils.pas<br/>功能&nbsp;&nbsp;用指定的格式Format来格式化日期时间DateTime并返回到字符串Result中<br/>说明&nbsp;&nbsp;&lt;参见FormatDateTime&gt;<br/>参考&nbsp;&nbsp;function System.SetString<br/>例子&nbsp;&nbsp;&lt;参见FormatDateTime&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function FloatToDateTime(const Value: Extended): TDateTime; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回浮点数转换成日期时间类型<br/>说明&nbsp;&nbsp;如果浮点数超出范围将触发异常<br/>参考&nbsp;&nbsp;function System.Int<br/>例子&nbsp;&nbsp;Edit2.Text := DateTimeToStr(FloatToDateTime(StrToFloatDef(Edit1.Text, 0)));<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function SysErrorMessage(ErrorCode: Integer): string; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回系统中错误代码所对应的信息<br/>说明&nbsp;&nbsp;此函可以有助于已习惯Windows编程的用户使用<br/>参考&nbsp;&nbsp;function Windows.FormatMessage;function System.SetString<br/>例子&nbsp;&nbsp;Edit1.Text := SysErrorMessage(SpinEdit1.Value);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function GetLocaleStr(Locale, LocaleType: Integer; const Default: string): string; platform; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回当前系统指定参数的字符串值<br/>说明&nbsp;&nbsp;GetLocaleStr(GetThreadLocale, LOCALE_SLANGUAGE, &#39;&#39;) = &#39;中文(中国)&#39;<br/>参考&nbsp;&nbsp;function Windows.GetLocaleInfo<br/>例子&nbsp;&nbsp;Edit1.Text := GetLocaleStr(GetThreadLocale, SpinEdit1.Value, &#39;&lt;NULL&gt;&#39;);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function GetLocaleChar(Locale, LocaleType: Integer; Default: Char): Char; platform; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回当前系统指定参数的字符值<br/>说明&nbsp;&nbsp;GetLocaleChar(GetThreadLocale, LOCALE_STHOUSAND, #0) = &#39;,&#39;<br/>参考&nbsp;&nbsp;function Windows.GetLocaleInfo<br/>例子&nbsp;&nbsp;Edit1.Text := GetLocaleChar(GetThreadLocale, LOCALE_SLANGUAGE, #0);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;procedure GetFormatSettings; $[SysUtils.pas<br/>功能&nbsp;&nbsp;恢复系统参数设置<br/>说明&nbsp;&nbsp;日期时间格式等<br/>参考&nbsp;&nbsp;function Windows.GetThreadLocale;function Windows.GetLocaleStr<br/>例子<br/>///////Begin GetFormatSettings<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>begin<br/>&nbsp;&nbsp;ShortDateFormat := &#39;YYYY&#34;年&#34;MM&#34;月&#34;DD&#34;日&#34;&#39;;<br/>&nbsp;&nbsp;ShowMessage(DateToStr(Date));<br/>&nbsp;&nbsp;GetFormatSettings;<br/>&nbsp;&nbsp;ShowMessage(DateToStr(Date));<br/>end;<br/>///////End GetFormatSettings<br/>━━━━━━━━━━━━━━━━━━━━━ <br/>首部&nbsp;&nbsp;function InquireSignal(RtlSigNum: Integer): TSignalState; $[SysUtils.pas<br/>功能&nbsp;&nbsp;&lt;NULL&gt;<br/>说明&nbsp;&nbsp;Kylix函数<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子&nbsp;&nbsp;&lt;NULL&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;procedure AbandonSignalHandler(RtlSigNum: Integer); $[SysUtils.pas<br/>功能&nbsp;&nbsp;&lt;NULL&gt;<br/>说明&nbsp;&nbsp;Kylix函数<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子&nbsp;&nbsp;&lt;NULL&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;procedure HookSignal(RtlSigNum: Integer); $[SysUtils.pas<br/>功能&nbsp;&nbsp;&lt;NULL&gt;<br/>说明&nbsp;&nbsp;Kylix函数<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子&nbsp;&nbsp;&lt;NULL&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;procedure UnhookSignal(RtlSigNum: Integer; OnlyIfHooked: Boolean = True); $[SysUtils.pas<br/>功能&nbsp;&nbsp;&lt;NULL&gt;<br/>说明&nbsp;&nbsp;Kylix函数<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子&nbsp;&nbsp;&lt;NULL&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;procedure HookOSExceptions; $[SysUtils.pas<br/>功能&nbsp;&nbsp;&lt;NULL&gt;<br/>说明&nbsp;&nbsp;Kylix函数<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子&nbsp;&nbsp;&lt;NULL&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function MapSignal(SigNum: Integer; Context: PSigContext): LongWord; $[SysUtils.pas<br/>功能&nbsp;&nbsp;&lt;NULL&gt;<br/>说明&nbsp;&nbsp;Kylix函数<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子&nbsp;&nbsp;&lt;NULL&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;procedure SignalConverter(ExceptionEIP: LongWord; FaultAddr: LongWord; ErrorCode: LongWord); $[SysUtils.pas<br/>功能&nbsp;&nbsp;&lt;NULL&gt;<br/>说明&nbsp;&nbsp;Kylix函数<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子&nbsp;&nbsp;&lt;NULL&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;procedure SetSafeCallExceptionMsg(Msg: String); $[SysUtils.pas<br/>功能&nbsp;&nbsp;&lt;NULL&gt;<br/>说明&nbsp;&nbsp;Kylix函数<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子&nbsp;&nbsp;&lt;NULL&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;procedure SetSafeCallExceptionAddr(Addr: Pointer); $[SysUtils.pas<br/>功能&nbsp;&nbsp;&lt;NULL&gt;<br/>说明&nbsp;&nbsp;Kylix函数<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子&nbsp;&nbsp;&lt;NULL&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function GetSafeCallExceptionMsg: String; $[SysUtils.pas<br/>功能&nbsp;&nbsp;&lt;NULL&gt;<br/>说明&nbsp;&nbsp;Kylix函数<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子&nbsp;&nbsp;&lt;NULL&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function GetSafeCallExceptionAddr: Pointer; $[SysUtils.pas<br/>功能&nbsp;&nbsp;&lt;NULL&gt;<br/>说明&nbsp;&nbsp;Kylix函数<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子&nbsp;&nbsp;&lt;NULL&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function LoadLibrary(ModuleName: PChar): HMODULE; $[SysUtils.pas<br/>功能&nbsp;&nbsp;&lt;NULL&gt;<br/>说明&nbsp;&nbsp;Kylix函数<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子&nbsp;&nbsp;&lt;NULL&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function FreeLibrary(Module: HMODULE): LongBool; $[SysUtils.pas<br/>功能&nbsp;&nbsp;&lt;NULL&gt;<br/>说明&nbsp;&nbsp;Kylix函数<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子&nbsp;&nbsp;&lt;NULL&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function GetProcAddress(Module: HMODULE; Proc: PChar): Pointer; $[SysUtils.pas<br/>功能&nbsp;&nbsp;&lt;NULL&gt;<br/>说明&nbsp;&nbsp;Kylix函数<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子&nbsp;&nbsp;&lt;NULL&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function GetModuleHandle(ModuleName: PChar): HMODULE; $[SysUtils.pas<br/>功能&nbsp;&nbsp;&lt;NULL&gt;<br/>说明&nbsp;&nbsp;Kylix函数<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子&nbsp;&nbsp;&lt;NULL&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function GetPackageModuleHandle(PackageName: PChar): HMODULE; $[SysUtils.pas<br/>功能&nbsp;&nbsp;&lt;NULL&gt;<br/>说明&nbsp;&nbsp;Kylix函数<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子&nbsp;&nbsp;&lt;NULL&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;procedure Sleep(milliseconds: Cardinal);{$IFDEF MSWINDOWS} stdcall; {$ENDIF} $[SysUtils.pas<br/>功能&nbsp;&nbsp;让程序休眠一段时间<br/>说明&nbsp;&nbsp;以微米为单位<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子&nbsp;&nbsp;Sleep(3000);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function GetModuleName(Module: HMODULE): string; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回动态连接库的名称<br/>说明&nbsp;&nbsp;如果参数为0则返回当前程序的名称<br/>参考&nbsp;&nbsp;function Windows.GetModuleFileName<br/>例子<br/>///////Begin GetModuleName<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>var<br/>&nbsp;&nbsp;vHandle: THandle;<br/>begin<br/>&nbsp;&nbsp;vHandle := LoadLibrary(PChar(Edit1.Text));<br/>&nbsp;&nbsp;Caption := GetModuleName(vHandle);<br/>&nbsp;&nbsp;FreeLibrary(vHandle);<br/>end;<br/>///////End GetModuleName<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function ExceptionErrorMessage(ExceptObject: TObject; ExceptAddr: Pointer; Buffer: PChar; Size: Integer): Integer; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回操作指针失败的信息长度<br/>说明&nbsp;&nbsp;信息放在缓冲Buffer中<br/>参考&nbsp;&nbsp;function Windows.VirtualQuery;function Windows.GetModuleFilename<br/>例子<br/>///////Begin ExceptionErrorMessage<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>var<br/>&nbsp;&nbsp;vBuffer: array[0..255] of Char;<br/>begin<br/>&nbsp;&nbsp;ExceptionErrorMessage(Self, Self, vBuffer, 255);<br/>&nbsp;&nbsp;Caption := vBuffer;<br/>end;<br/>///////End ExceptionErrorMessage<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;procedure ShowException(ExceptObject: TObject; ExceptAddr: Pointer); $[SysUtils.pas<br/>功能&nbsp;&nbsp;提示一个操作指针失败的错误<br/>说明&nbsp;&nbsp;支持控制台程序<br/>参考&nbsp;&nbsp;function SysUtils.ExceptionErrorMessage;var System.IsConsole;function System.FindResourceHInstance<br/>例子&nbsp;&nbsp;ShowException(Self, Self);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;procedure Abort; $[SysUtils.pas<br/>功能&nbsp;&nbsp;引起放弃的意外处理<br/>说明&nbsp;&nbsp;不显示任何错误信息<br/>参考&nbsp;&nbsp;type SysUtils.EAbort<br/>例子&nbsp;&nbsp;Abort;<br/>━━━━━━━━━━━━━━━━━━━━━&nbsp;&nbsp;<br/>首部&nbsp;&nbsp;procedure OutOfMemoryError; $[SysUtils.pas<br/>功能&nbsp;&nbsp;触发内存益出异常<br/>说明&nbsp;&nbsp;&lt;NULL&gt;<br/>参考&nbsp;&nbsp;var SysUtils.OutOfMemory<br/>例子&nbsp;&nbsp;OutOfMemoryError;<br/>━━━━━━━━━━━━━━━━━━━━━&nbsp;&nbsp;<br/>首部&nbsp;&nbsp;procedure Beep; $[SysUtils.pas<br/>功能&nbsp;&nbsp;触发计算机出声<br/>说明&nbsp;&nbsp;MessageBeep(0);<br/>参考&nbsp;&nbsp;function Windows.MessageBeep<br/>例子&nbsp;&nbsp;Beep;<br/>━━━━━━━━━━━━━━━━━━━━━&nbsp;&nbsp;<br/>首部&nbsp;&nbsp;function ByteType(const S: string; Index: Integer): TMbcsByteType; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回字符串S位置Index上的字符在MBCS中类型<br/>说明&nbsp;&nbsp;多字节字符系统:Multi-Byte Character System (MBCS)<br/>参考&nbsp;&nbsp;var SysUtils.SysLocale<br/>例子&nbsp;&nbsp;SpinEdit1.Value := o&#114;d(ByteType(Edit1.Text, SpinEdit2.Value));<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function StrByteType(Str: PChar; Index: Cardinal): TMbcsByteType; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回指针字符串Str位置Index上的字符在MBCS中类型<br/>说明&nbsp;&nbsp;Index从0开始<br/>参考&nbsp;&nbsp;var SysUtils.SysLocale<br/>例子&nbsp;&nbsp;SpinEdit1.Value := o&#114;d(StrByteType(PChar(Edit1.Text), SpinEdit2.Value));<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function ByteToCharLen(const S: string; MaxLen: Integer): Integer; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回字符串S中有多少个多字节字符<br/>说明&nbsp;&nbsp;MaxLen指定处理字符个数<br/>参考&nbsp;&nbsp;function SysUtils.ByteToCharIndex<br/>例子&nbsp;&nbsp;SpinEdit1.Value := ByteToCharLen(Edit1.Text, SpinEdit2.Value);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function CharToByteLen(const S: string; MaxLen: Integer): Integer; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回字符串S中有多少个字符<br/>说明&nbsp;&nbsp;MaxLen指定处理多字节字符个数<br/>参考&nbsp;&nbsp;var SysUtils.SysLocale<br/>例子&nbsp;&nbsp;SpinEdit1.Value := CharToByteLen(Edit1.Text, SpinEdit2.Value);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function ByteToCharIndex(const S: string; Index: Integer): Integer; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回字符位置对应的多字节字符位置<br/>说明&nbsp;&nbsp;ByteToCharIndex(&#39;你好&#39;, 2) = 1;ByteToCharIndex(&#39;你好&#39;, 3) = 2<br/>参考&nbsp;&nbsp;function SysUtils.NextCharIndex<br/>例子&nbsp;&nbsp;SpinEdit1.Value := ByteToCharIndex(Edit1.Text, SpinEdit2.Value);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function CharToByteIndex(const S: string; Index: Integer): Integer; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回多字节字符位置对应的字符起始位置<br/>说明&nbsp;&nbsp;CharToByteIndex(&#39;你好&#39;, 1) = 1;CharToByteIndex(&#39;你好&#39;, 2) = 3<br/>参考&nbsp;&nbsp;function System.Length<br/>例子&nbsp;&nbsp;SpinEdit1.Value := CharToByteIndex(Edit1.Text, SpinEdit2.Value);<br/>━━━━━━━━━━━━━━━━━━━━━&nbsp;&nbsp;<br/>首部&nbsp;&nbsp;function StrCharLength(const Str: PChar): Integer; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回第一个字符的宽度<br/>说明&nbsp;&nbsp;参数为空则返回0<br/>参考&nbsp;&nbsp;function Windows.CharNext<br/>例子&nbsp;&nbsp;SpinEdit1.Value := StrCharLength(PChar(Edit1.Text));<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function StrNextChar(const Str: PChar): PChar; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回字符指针Str的下一个字符指针<br/>说明&nbsp;&nbsp;StrNextChar(&#39;1234&#39;) = &#39;234&#39;;<br/>参考&nbsp;&nbsp;function Windows.CharNext<br/>例子&nbsp;&nbsp;Edit2.Text := StrNextChar(PChar(Edit1.Text));<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function CharLength(const S: String; Index: Integer): Integer; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回字符串中指定位置的字符宽度<br/>说明&nbsp;&nbsp;CharLength(&#39;English汉&#39;, 1) = 1;CharLength(&#39;English汉&#39;, 8) = 2<br/>参考&nbsp;&nbsp;function System.Assert;function SysUtils.StrCharLength<br/>例子&nbsp;&nbsp;SpinEdit1.Value := CharLength(Edit1.Text, SpinEdit2.Value);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function NextCharIndex(const S: String; Index: Integer): Integer; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回下一个字符的位置<br/>说明&nbsp;&nbsp;CharLength(&#39;你好&#39;, 1) = 3;CharLength(&#39;你好&#39;, 3) = 5<br/>参考&nbsp;&nbsp;function System.Assert;function SysUtils.StrCharLength<br/>例子&nbsp;&nbsp;SpinEdit1.Value := NextCharIndex(Edit1.Text, SpinEdit2.Value);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function IsPathDelimiter(const S: string; Index: Integer): Boolean; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回字符串S中指定位置Index上是否是一个路径分隔符<br/>说明&nbsp;&nbsp;IsPathDelimiter(&#39;C:\Windows&#39;, 3) = True<br/>参考&nbsp;&nbsp;const SysUtils.PathDelim;function SysUtils.ByteType<br/>例子&nbsp;&nbsp;CheckBox1.Checked := IsPathDelimiter(Edit1.Text, SpinEdit1.Value);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function IsDelimiter(const Delimiters, S: string; Index: Integer): Boolean; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回字符串S中指定位置Index上是否是一个分隔符Delimiters<br/>说明&nbsp;&nbsp;IsDelimiter(&#39;@&#39;, &#39;wjhu111@21cn.com&#39;, 8) = True<br/>参考&nbsp;&nbsp;function SysUtils.ByteType<br/>例子&nbsp;&nbsp;CheckBox1.Checked := IsDelimiter(Edit1.Text, Edit2.Text, SpinEdit1.Value);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function IncludeTrailingPathDelimiter(const S: string): string; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回包括最后路径分隔符<br/>说明&nbsp;&nbsp;最后一个字符是路径分隔符则不变;否则加上一个路径分隔符返回<br/>参考&nbsp;&nbsp;function SysUtils.IsPathDelimiter;function System.Length<br/>例子&nbsp;&nbsp;Edit1.Text := IncludeTrailingPathDelimiter(Edit2.Text);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function IncludeTrailingBackslash(const S: string): string; platform; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回包括最后斜线<br/>说明&nbsp;&nbsp;Result := IncludeTrailingPathDelimiter(S);<br/>参考&nbsp;&nbsp;function SysUtils.IncludeTrailingPathDelimiter<br/>例子&nbsp;&nbsp;Edit1.Text := IncludeTrailingBackslash(Edit2.Text);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function ExcludeTrailingPathDelimiter(const S: string): string; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回排除最后路径分隔符<br/>说明&nbsp;&nbsp;最后一个字符不是路径分隔符则不变;否则减去最后的路径分隔符返回<br/>参考&nbsp;&nbsp;function SysUtils.IsPathDelimiter;function System.Length;function System.SetLength<br/>例子&nbsp;&nbsp;Edit1.Text := ExcludeTrailingPathDelimiter(Edit2.Text);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function ExcludeTrailingBackslash(const S: string): string; platform; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回排除最后斜线<br/>说明&nbsp;&nbsp;Result := ExcludeTrailingPathDelimiter(S)<br/>参考&nbsp;&nbsp;function SysUtils.ExcludeTrailingPathDelimiter<br/>例子&nbsp;&nbsp;Edit1.Text := ExcludeTrailingBackslash(Edit2.Text);<br/>━━━━━━━━━━━━━━━━━━━━━&nbsp;&nbsp;<br/>首部&nbsp;&nbsp;function LastDelimiter(const Delimiters, S: string): Integer; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回最后一个分隔符的位置<br/>说明&nbsp;&nbsp;LastDelimiter(&#39;.&#39;, &#39;kingron.myetang.com&#39;) = 16<br/>参考&nbsp;&nbsp;function SysUtils.StrScan;function SysUtils.ByteType<br/>例子&nbsp;&nbsp;SpinEdit1.Value := LastDelimiter(Edit1.Text, Edit2.Text);<br/>━━━━━━━━━━━━━━━━━━━━━&nbsp;&nbsp;<br/>首部&nbsp;&nbsp;function AnsiCompareFileName(const S1, S2: string): Integer; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回比较两个文件名<br/>说明&nbsp;&nbsp;当S1&gt;S2返回值&gt;0;当S1&lt;S2返回值&lt;0;当S1=S2返回值=0;区分大小写<br/>参考&nbsp;&nbsp;function SysUtils.AnsiCompareStr<br/>例子&nbsp;&nbsp;SpinEdit1.Value := AnsiCompareFileName(Edit1.Text, Edit2.Text);<br/>━━━━━━━━━━━━━━━━━━━━━&nbsp;&nbsp;<br/>首部&nbsp;&nbsp;function SameFileName(const S1, S2: string): Boolean; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回两个文件名是否相等<br/>说明&nbsp;&nbsp;区分大小写<br/>参考&nbsp;&nbsp;function SysUtils.AnsiCompareFileName<br/>例子&nbsp;&nbsp;CheckBox1.Checked := SameFileName(Edit1.Text, Edit2.Text);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function AnsiLowerCaseFileName(const S: string): string; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回小写文件名<br/>说明&nbsp;&nbsp;在非多字节字符系统上相当于AnsiLowerCase<br/>参考&nbsp;&nbsp;function SysUtils.AnsiLowerCase<br/>例子&nbsp;&nbsp;Edit2.Text := AnsiLowerCaseFileName(Edit1.Text);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function AnsiUpperCaseFileName(const S: string): string; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回大写文件名<br/>说明&nbsp;&nbsp;在非多字节字符系统上相当于AnsiUpperCase<br/>参考&nbsp;&nbsp;function SysUtils.AnsiUpperCase<br/>例子&nbsp;&nbsp;Edit2.Text := AnsiUpperCaseFileName(Edit1.Text);<br/>━━━━━━━━━━━━━━━━━━━━━&nbsp;&nbsp;<br/>首部&nbsp;&nbsp;function AnsiPos(const Substr, S: string): Integer; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回子串Substr在字符中第一次出现的位置<br/>说明&nbsp;&nbsp;不存在则返回0<br/>参考&nbsp;&nbsp;SysUtils.AnsiStrPos<br/>例子&nbsp;&nbsp;SpinEdit1.Value := AnsiPos(Edit1.Text, Edit2.Text);<br/>━━━━━━━━━━━━━━━━━━━━━&nbsp;&nbsp;<br/>首部&nbsp;&nbsp;function AnsiStrPos(Str, SubStr: PChar): PChar; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回指针子串Substr在指针字符中第一次出现的指针位置<br/>说明&nbsp;&nbsp;不存在则返回nil<br/>参考&nbsp;&nbsp;function SysUtils.StrByteType<br/>例子&nbsp;&nbsp;Edit3.Text := AnsiStrPos(PChar(Edit1.Text), PChar(Edit2.Text));<br/>━━━━━━━━━━━━━━━━━━━━━&nbsp;&nbsp;<br/>首部&nbsp;&nbsp;function AnsiStrRScan(Str: PChar; Chr: Char): PChar; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回在指针字符串Str搜索字符Chr最后一个出现的地址<br/>说明&nbsp;&nbsp;支持多字节字符系统;AnsiStrRScan(&#39;kingron.myetang.com&#39;, &#39;.&#39;) = &#39;.com&#39;<br/>参考&nbsp;&nbsp;function SysUtils.AnsiStrScan<br/>例子&nbsp;&nbsp;Edit2.Text := AnsiStrScan(PChar(Edit1.Text), &#39;.&#39;);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function AnsiStrScan(Str: PChar; Chr: Char): PChar; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回在指针字符串Str搜索字符Chr第一个出现的地址<br/>说明&nbsp;&nbsp;支持多字节字符系统;AnsiStrRScan(&#39;kingron.myetang.com&#39;, &#39;.&#39;) = &#39;.myetang.com&#39;<br/>参考&nbsp;&nbsp;function SysUtils.StrScan<br/>例子&nbsp;&nbsp;Edit2.Text := AnsiStrScan(PChar(Edit1.Text), &#39;.&#39;);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function StringReplace(const S, OldPattern, NewPattern: string; Flags: TReplaceFlags): string; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回替换后的字符串<br/>说明&nbsp;&nbsp;rfReplaceAll为替换全部内容;rfIgnoreCase为忽略大小写<br/>参考&nbsp;&nbsp;function SysUtils.AnsiUpperCase;function SysUtils.AnsiPos;function System.Copy<br/>例子<br/>///////Begin StringReplace<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>begin<br/>&nbsp;&nbsp;Memo1.Lines.Values[&#39;[]&#39;] :=<br/>&nbsp;&nbsp;&nbsp;&nbsp;StringReplace(Edit1.Text, Edit2.Text, Edit3.Text, []);<br/>&nbsp;&nbsp;Memo1.Lines.Values[&#39;[rfReplaceAll]&#39;] :=<br/>&nbsp;&nbsp;&nbsp;&nbsp;StringReplace(Edit1.Text, Edit2.Text, Edit3.Text, [rfReplaceAll]);<br/>&nbsp;&nbsp;Memo1.Lines.Values[&#39;[rfIgnoreCase]&#39;] :=<br/>&nbsp;&nbsp;&nbsp;&nbsp;StringReplace(Edit1.Text, Edit2.Text, Edit3.Text, [rfIgnoreCase]);<br/>&nbsp;&nbsp;Memo1.Lines.Values[&#39;[rfReplaceAll, rfIgnoreCase]&#39;] :=<br/>&nbsp;&nbsp;&nbsp;&nbsp;StringReplace(Edit1.Text, Edit2.Text, Edit3.Text, [rfReplaceAll, rfIgnoreCase]);<br/>end;<br/>///////End StringReplace<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function WrapText(const Line, BreakStr: string; const BreakChars: TSysCharSet; MaxCol: Integer): string; overload; $[SysUtils.pas<br/>首部&nbsp;&nbsp;function WrapText(const Line: string; MaxCol: Integer = 45): string; overload; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回对字符串自动换行<br/>说明&nbsp;&nbsp;Result := WrapText(Line, sLineBreak, [&#39; &#39;, &#39;-&#39;, #9], MaxCol);<br/>参考&nbsp;&nbsp;function SysUtils.CharLength;function SysUtils.CompareText<br/>例子&nbsp;&nbsp;Memo1.Text := WrapText(Memo2.Text, SpinEdit1.Value); <br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function FindCmdLineSwitch(const Switch: string; const Chars: TSysCharSet; IgnoreCase: Boolean): Boolean; overload; $[SysUtils.pas<br/>首部&nbsp;&nbsp;function FindCmdLineSwitch(const Switch: string): Boolean; overload; $[SysUtils.pas<br/>首部&nbsp;&nbsp;function FindCmdLineSwitch(const Switch: string; IgnoreCase: Boolean): Boolean; overload; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回程序命令参数是否找到<br/>说明&nbsp;&nbsp;Result := FindCmdLineSwitch(Switch, SwitchChars, True);<br/>参考&nbsp;&nbsp;function System.ParamCount;function System.ParamStr;function SysUtils.AnsiCompareText<br/>例子&nbsp;&nbsp;CheckBox1.Checked := FindCmdLineSwitch(Edit1.Text);<br/>━━━━━━━━━━━━━━━━━━━━━&nbsp;&nbsp;<br/>首部&nbsp;&nbsp;procedure FreeAndNil(var Obj); $[SysUtils.pas<br/>功能&nbsp;&nbsp;释放对象Obj并赋为空<br/>说明&nbsp;&nbsp;如果对象已经释放资源将触发异常<br/>参考&nbsp;&nbsp;type System.TObject<br/>例子<br/>///////Begin FreeAndNil<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>var<br/>&nbsp;&nbsp;Temp: TObject;<br/>begin<br/>&nbsp;&nbsp;Temp := TObject.Cr&#101;ate;<br/>&nbsp;&nbsp;Temp.Free;<br/>&nbsp;&nbsp;ShowMessage(Format(&#39;%p&#39;, [Pointer(Temp)]));<br/><br/>&nbsp;&nbsp;Temp := TObject.Cr&#101;ate;<br/>&nbsp;&nbsp;FreeAndNil(Temp);<br/>&nbsp;&nbsp;ShowMessage(Format(&#39;%p&#39;, [Pointer(Temp)]));<br/>end;<br/>///////End FreeAndNil<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function Supports(const Instance: IInterface; const IID: TGUID; out Intf): Boolean; overload; $[SysUtils.pas<br/>首部&nbsp;&nbsp;function Supports(const Instance: TObject; const IID: TGUID; out Intf): Boolean; overload; $[SysUtils.pas<br/>首部&nbsp;&nbsp;function Supports(const Instance: IInterface; const IID: TGUID): Boolean; overload; $[SysUtils.pas<br/>首部&nbsp;&nbsp;function Supports(const Instance: TObject; const IID: TGUID): Boolean; overload; $[SysUtils.pas<br/>首部&nbsp;&nbsp;function Supports(const AClass: TClass; const IID: TGUID): Boolean; overload; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回对象是否支持指定的接口<br/>说明&nbsp;&nbsp;Result := AClass.GetInterfaceEntry(IID) &lt;&gt; nil;<br/>参考&nbsp;&nbsp;type System.TObject<br/>例子&nbsp;&nbsp;&lt;NULL&gt;<br/>━━━━━━━━━━━━━━━━━━━━━&nbsp;&nbsp;<br/>首部&nbsp;&nbsp;function Cr&#101;ateGUID(out Guid: TGUID): HResult; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回创建全局标识是否成功<br/>说明&nbsp;&nbsp;返回S_OK表示成功<br/>参考&nbsp;&nbsp;function Windows.CoCr&#101;ateGuid<br/>例子<br/>///////Begin Cr&#101;ateGUID<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>var<br/>&nbsp;&nbsp;vGUID: TGUID;<br/>begin<br/>&nbsp;&nbsp;Cr&#101;ateGUID(vGUID);<br/>&nbsp;&nbsp;Edit1.Text := GUIDToString(vGUID);<br/>end;<br/>///////End Cr&#101;ateGUID<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function StringToGUID(const S: string): TGUID; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回字符串S转换成全局标识<br/>说明&nbsp;&nbsp;如果字符串非法将触发异常<br/>参考&nbsp;&nbsp;fuction Windows.Succeeded<br/>例子&nbsp;&nbsp;Edit2.Text := GUIDToString(StringToGUID(Edit1.Text));<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function GUIDToString(const GUID: TGUID): string; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回全局标识GUID转换成字符串<br/>说明&nbsp;&nbsp;&lt;NULL&gt;<br/>参考&nbsp;&nbsp;fuction Windows.Succeeded<br/>例子&nbsp;&nbsp;Edit2.Text := GUIDToString(StringToGUID(Edit1.Text));<br/>━━━━━━━━━━━━━━━━━━━━━&nbsp;&nbsp;<br/>首部&nbsp;&nbsp;function IsEqualGUID(const guid1, guid2: TGUID): Boolean; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回两个全局标识是否相同<br/>说明&nbsp;&nbsp;function IsEqualGUID; external &#39;ole32.dll&#39; name &#39;IsEqualGUID&#39;;<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子&nbsp;&nbsp;CheckBox1.Checked := IsEqualGUID(StringToGUID(Edit1.Text), StringToGUID(Edit2.Text));<br/>━━━━━━━━━━━━━━━━━━━━━&nbsp;&nbsp;<br/>首部&nbsp;&nbsp;function LoadPackage(const Name: string): HMODULE; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回载入包资源<br/>说明&nbsp;&nbsp;&lt;NULL&gt;<br/>参考&nbsp;&nbsp;function SysUtils.SafeLoadLibrary;function SysUtils.InitializePackage;function Windows.FreeLibrary<br/>例子&nbsp;&nbsp;&lt;NULL&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;procedure UnloadPackage(Module: HMODULE); $[SysUtils.pas<br/>功能&nbsp;&nbsp;取消载入包资源<br/>说明&nbsp;&nbsp;&lt;NULL&gt;<br/>参考&nbsp;&nbsp;function SysUtils.FinalizePackage;function Windows.FreeLibrary<br/>例子&nbsp;&nbsp;&lt;NULL&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;procedure GetPackageInfo(Module: HMODULE; Param: Pointer; var Flags: Integer; InfoProc: TPackageInfoProc); $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回包的信息<br/>说明&nbsp;&nbsp;&lt;NULL&gt;<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子&nbsp;&nbsp;&lt;NULL&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function GetPackageDescription(ModuleName: PChar): string; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回包的描述<br/>说明&nbsp;&nbsp;&lt;NULL&gt;<br/>参考&nbsp;&nbsp;function System.LoadResourceModule;function Windows.LoadLibraryEx<br/>例子&nbsp;&nbsp;&lt;NULL&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;procedure InitializePackage(Module: HMODULE); $[SysUtils.pas<br/>功能&nbsp;&nbsp;初始化包<br/>说明&nbsp;&nbsp;&lt;NULL&gt;<br/>参考&nbsp;&nbsp;function Windos.GetProcAddress<br/>例子&nbsp;&nbsp;&lt;NULL&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;procedure FinalizePackage(Module: HMODULE); $[SysUtils.pas<br/>功能&nbsp;&nbsp;终止化包<br/>说明&nbsp;&nbsp;&lt;NULL&gt;<br/>参考&nbsp;&nbsp;function Windos.GetProcAddress<br/>例子&nbsp;&nbsp;&lt;NULL&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;procedure RaiseLastOSError; $[SysUtils.pas<br/>功能&nbsp;&nbsp;触发操作系统的最后一个异常<br/>说明&nbsp;&nbsp;如果没有出现异常则默认调用Api函数异常<br/>参考&nbsp;&nbsp;function Windows.GetLastError<br/>例子&nbsp;&nbsp;RaiseLastOSError;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;procedure RaiseLastWin32Error; deprecated; $[SysUtils.pas<br/>功能&nbsp;&nbsp;触发Win32系统的最后一个异常<br/>说明&nbsp;&nbsp;如果没有出现异常则默认调用Api函数异常<br/>参考&nbsp;&nbsp;function SysUtils.RaiseLastOSError;<br/>例子&nbsp;&nbsp;RaiseLastWin32Error;<br/>━━━━━━━━━━━━━━━━━━━━━&nbsp;&nbsp;<br/>首部&nbsp;&nbsp;function Win32Check(RetVal: BOOL): BOOL; platform; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回检测调用系统Api函数返回结果<br/>说明&nbsp;&nbsp;如果RetVal为False则触发异常<br/>参考&nbsp;&nbsp;function SysUtils.RaiseLastOSError<br/>例子&nbsp;&nbsp;CheckBox2.Checked := Win32Check(CheckBox1.Checked);<br/>━━━━━━━━━━━━━━━━━━━━━&nbsp;&nbsp;<br/>首部&nbsp;&nbsp;procedure AddTerminateProc(TermProc: TTerminateProc); $[SysUtils.pas<br/>功能&nbsp;&nbsp;添加一个退出过程到系统中<br/>说明&nbsp;&nbsp;执行AddTerminateProc(nil)将导致系统异常<br/>参考&nbsp;&nbsp;const System.TerminateProcList<br/>例子<br/>///////Begin AddTerminateProc<br/>function NewTerminateProc: Boolean;<br/>begin<br/>&nbsp;&nbsp;Result := True;<br/>&nbsp;&nbsp;ShowMessage(&#39;NewTerminateProc&#39;);<br/>end;<br/><br/>procedure TForm1.Button1Click(Sender: TObject);<br/>begin<br/>&nbsp;&nbsp;AddTerminateProc(NewTerminateProc);<br/>end;<br/>///////End AddTerminateProc<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function CallTerminateProcs: Boolean; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回调用退出过程是否成功<br/>说明&nbsp;&nbsp;不建议调用<br/>参考&nbsp;&nbsp;const System.TerminateProcList<br/>例子&nbsp;&nbsp;CallTerminateProcs;<br/>━━━━━━━━━━━━━━━━━━━━━&nbsp;&nbsp;<br/>首部&nbsp;&nbsp;function GDAL: LongWord; $[SysUtils.pas<br/>功能&nbsp;&nbsp;&lt;NULL&gt;<br/>说明&nbsp;&nbsp;&lt;NULL&gt;<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子&nbsp;&nbsp;&lt;NULL&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;procedure RCS; $[SysUtils.pas<br/>功能&nbsp;&nbsp;&lt;NULL&gt;<br/>说明&nbsp;&nbsp;&lt;NULL&gt;<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子&nbsp;&nbsp;&lt;NULL&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;procedure RPR; $[SysUtils.pas<br/>功能&nbsp;&nbsp;&lt;NULL&gt;<br/>说明&nbsp;&nbsp;&lt;NULL&gt;<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子&nbsp;&nbsp;&lt;NULL&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function SafeLoadLibrary(const Filename: string; ErrorMode: UINT = SEM_NOOPENFILEERRORBOX): HMODULE; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回安全方式载入动态连接库资源<br/>说明&nbsp;&nbsp;&lt;参见LoadLibrary&gt;<br/>参考&nbsp;&nbsp;function Windows.LoadLibrary<br/>例子&nbsp;&nbsp;&lt;NULL&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function GetEnvironmentVariable(const Name: string): string; overload; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回过程环境变量<br/>说明&nbsp;&nbsp;配合SetEnvironmentVariable函数使用<br/>参考&nbsp;&nbsp;function Windows.GetEnvironmentVariable<br/>例子&nbsp;&nbsp;Edit1.Text := GetEnvironmentVariable(Edit2.Text);<br/>///////Begin GetEnvironmentVariable<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>begin<br/>&nbsp;&nbsp;SetEnvironmentVariable(PChar(Edit2.Text), PChar(Edit3.Text));<br/>&nbsp;&nbsp;Edit1.Text := GetEnvironmentVariable(Edit2.Text);<br/>end;<br/>///////End GetEnvironmentVariable<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function InterlockedIncrement(var I: Integer): Integer; $[SysUtils.pas<br/>功能&nbsp;&nbsp;&lt;NULL&gt;<br/>说明&nbsp;&nbsp;Kylix函数<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子&nbsp;&nbsp;&lt;NULL&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function InterlockedDecrement(var I: Integer): Integer; $[SysUtils.pas<br/>功能&nbsp;&nbsp;&lt;NULL&gt;<br/>说明&nbsp;&nbsp;Kylix函数<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子&nbsp;&nbsp;&lt;NULL&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function InterlockedExchange(var A: Integer; B: Integer): Integer; $[SysUtils.pas<br/>功能&nbsp;&nbsp;&lt;NULL&gt;<br/>说明&nbsp;&nbsp;Kylix函数<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子&nbsp;&nbsp;&lt;NULL&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function InterlockedExchangeAdd(var A: Integer; B: Integer): Integer; $[SysUtils.pas<br/>功能&nbsp;&nbsp;&lt;NULL&gt;<br/>说明&nbsp;&nbsp;Kylix函数<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子&nbsp;&nbsp;&lt;NULL&gt;<br/>━━━━━━━━━━━━━━━━━━━━━]]></description>
		</item>
		
			<item>
			<link>http://www.zjidea.com/blog/article/delphi/20091211_delphi_function3.htm</link>
			<title><![CDATA[Delphi函数大全3]]></title>
			<author>lzq0323@yahoo.com.cn(相逢萍水)</author>
			<category><![CDATA[Delphi编程]]></category>
			<pubDate>Fri,11 Dec 2009 13:12:45 +0800</pubDate>
			<guid>http://www.zjidea.com/blog/default.asp?id=458</guid>
		<description><![CDATA[首部&nbsp;&nbsp;procedure StrDispose(Str: PChar); $[SysUtils.pas<br/>功能&nbsp;&nbsp;释放指针字符串Str内存资源<br/>说明&nbsp;&nbsp;如果Str为nil则不作任何处理;并且释放空间大小信息<br/>参考&nbsp;&nbsp;function System.Dec;function System.SizeOf;function System.FreeMem<br/>例子&nbsp;&nbsp;&lt;参见StrNew&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function Format(const Format: string; const Args: array of const): string; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回按指定方式格式化一个数组常量的字符形式<br/>说明&nbsp;&nbsp;这个函数是我在Delphi中用得最多的函数，现在就列举几个例子给你个直观的理解<br/>&#34;%&#34; [索引 &#34;:&#34;] [&#34;-&#34;] [宽度] [&#34;.&#34; 摘要] 类型<br/>Format(&#39;x=%d&#39;, [12]); //&#39;x=12&#39; //最普通<br/>Format(&#39;x=%3d&#39;, [12]); //&#39;x= 12&#39; //指定宽度<br/>Format(&#39;x=%f&#39;, [12.0]); //&#39;x=12.00&#39; //浮点数<br/>Format(&#39;x=%.3f&#39;, [12.0]); //&#39;x=12.000&#39; //指定小数<br/>Format(&#39;x=%.*f&#39;, [5, 12.0]); //&#39;x=12.00000&#39; //动态配置<br/>Format(&#39;x=%.5d&#39;, [12]); //&#39;x=00012&#39; //前面补充0<br/>Format(&#39;x=%.5x&#39;, [12]); //&#39;x=0000C&#39; //十六进制<br/>Format(&#39;x=%1:d%0:d&#39;, [12, 13]); //&#39;x=1312&#39; //使用索引<br/>Format(&#39;x=%p&#39;, [nil]); //&#39;x=00000000&#39; //指针<br/>Format(&#39;x=%1.1e&#39;, [12.0]); //&#39;x=1.2E+001&#39; //科学记数法<br/>Format(&#39;x=%%&#39;, []); //&#39;x=%&#39; //得到&#34;%&#34;<br/>S := Format(&#39;%s%d&#39;, [S, I]); //S := S + StrToInt(I); //连接字符串<br/>参考&nbsp;&nbsp;proceduer SysUtils.FmtStr<br/>例子&nbsp;&nbsp;Edit1.Text := Format(Edit2.Text, [StrToFloatDef(Edit.3.Text, 0)]);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;procedure FmtStr(var Result: string; const Format: string; const Args: array of const); $[SysUtils.pas<br/>功能&nbsp;&nbsp;按指定方式格式化一个数组常量的字符形式返回<br/>说明&nbsp;&nbsp;&lt;参见Format&gt;<br/>参考&nbsp;&nbsp;function SysUtils.FormatBuf;function System.Length;function System.SetLength<br/>例子&nbsp;&nbsp;&lt;参见Format&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function StrFmt(Buffer, Format: PChar; const Args: array of const): PChar; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回按指定方式格式化一个数组常量的字符指针形式<br/>说明&nbsp;&nbsp;如果Buffer和Format其中只要有一个为nil则返回nil<br/>参考&nbsp;&nbsp;function SysUtils.FormatBuf<br/>例子&nbsp;&nbsp;&lt;参见Format&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function StrLFmt(Buffer: PChar; MaxBufLen: Cardinal; Format: PChar; const Args: array of const): PChar; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回按指定方式和长度格式化一个数组常量的字符指针形式<br/>说明&nbsp;&nbsp;StrLFmt(vBuffer, 6, &#39;%d|12345&#39;, [1024]) = &#39;1024|1&#39;;<br/>参考&nbsp;&nbsp;function SysUtils.FormatBuf<br/>例子&nbsp;&nbsp;&lt;参见Format&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function FormatBuf(var Buffer; BufLen: Cardinal; const Format; FmtLen: Cardinal; const Args: array of const): Cardinal; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回按指定方式格式化一个数组常量到缓冲区Buffer中<br/>说明&nbsp;&nbsp;&lt;NULL&gt;<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子&nbsp;&nbsp;&lt;参见Format&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function WideFormat(const Format: WideString; const Args: array of const): WideString; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回按指定方式格式化一个数组常量的多字节字符形式<br/>说明&nbsp;&nbsp;&lt;NULL&gt;<br/>参考&nbsp;&nbsp;procedure SysUtils.WideFmtStr<br/>例子&nbsp;&nbsp;&lt;参见Format&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;procedure WideFmtStr(var Result: WideString; const Format: WideString; const Args: array of const); $[SysUtils.pas<br/>功能&nbsp;&nbsp;按指定方式格式化一个数组常量的多字节字符形式返回<br/>说明&nbsp;&nbsp;&lt;NULL&gt;<br/>参考&nbsp;&nbsp;function SysUtils.WideFormatBuf<br/>例子&nbsp;&nbsp;&lt;参见Format&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function WideFormatBuf(var Buffer; BufLen: Cardinal; const Format; FmtLen: Cardinal; const Args: array of const): Cardinal; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回按指定方式格式化一个数组常量到缓冲区Buffer中<br/>说明&nbsp;&nbsp;&lt;NULL&gt;<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子&nbsp;&nbsp;&lt;参见Format&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function FloatToStr(Value: Extended): string; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回浮点数Value转换成字符串<br/>说明&nbsp;&nbsp;当浮点数大等于1E15将采用科学记数法<br/>参考&nbsp;&nbsp;function SysUtils.FloatToText<br/>例子&nbsp;&nbsp;Edit1.Text := FloatToStr(Now);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function CurrToStr(Value: Currency): string; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回货币数Value转换成字符串<br/>说明&nbsp;&nbsp;货币数只保留四位小数<br/>参考&nbsp;&nbsp;function SysUtils.FloatToText<br/>例子&nbsp;&nbsp;Edit1.Text := CurrToStr(Now);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function FloatToCurr(const Value: Extended): Currency; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回浮点数Value转换成货币数<br/>说明&nbsp;&nbsp;如果浮点数Value超出范围则将触发异常<br/>参考&nbsp;&nbsp;const SysUtiles.MinCurrency;const SysUtiles.MaxCurrency<br/>例子&nbsp;&nbsp;Edit1.Text := CurrToStr(FloatToCurr(Now));<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function FloatToStrF(Value: Extended; Format: TFloatFormat; Precision, Digits: Integer): string; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回浮点数以指定格式转换成字符串<br/>说明&nbsp;&nbsp;Precision指定精度;Digits指定小数宽度<br/>参考&nbsp;&nbsp;function SysUtils.FloatToText<br/>例子<br/>///////Begin FloatToStrF<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>begin<br/>&nbsp;&nbsp;Memo1.Lines.Values[&#39;ffGeneral&#39;] := FloatToStrF(StrToFloatDef(Edit1.Text, 0),<br/>&nbsp;&nbsp;&nbsp;&nbsp;ffGeneral, SpinEdit1.Value, SpinEdit2.Value);<br/>&nbsp;&nbsp;Memo1.Lines.Values[&#39;ffExponent&#39;] := FloatToStrF(StrToFloatDef(Edit1.Text, 0),<br/>&nbsp;&nbsp;&nbsp;&nbsp;ffExponent, SpinEdit1.Value, SpinEdit2.Value);<br/>&nbsp;&nbsp;Memo1.Lines.Values[&#39;ffFixed&#39;] := FloatToStrF(StrToFloatDef(Edit1.Text, 0),<br/>&nbsp;&nbsp;&nbsp;&nbsp;ffFixed, SpinEdit1.Value, SpinEdit2.Value);<br/>&nbsp;&nbsp;Memo1.Lines.Values[&#39;ffNumber&#39;] := FloatToStrF(StrToFloatDef(Edit1.Text, 0),<br/>&nbsp;&nbsp;&nbsp;&nbsp;ffNumber, SpinEdit1.Value, SpinEdit2.Value);<br/>&nbsp;&nbsp;Memo1.Lines.Values[&#39;ffCurrency&#39;] := FloatToStrF(StrToFloatDef(Edit1.Text, 0),<br/>&nbsp;&nbsp;&nbsp;&nbsp;ffCurrency, SpinEdit1.Value, SpinEdit2.Value);<br/>end;<br/>///////End FloatToStrF<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function CurrToStrF(Value: Currency; Format: TFloatFormat; Digits: Integer): string; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回货币类型以指定格式转换成字符串<br/>说明&nbsp;&nbsp;Digits指定小数宽度<br/>参考&nbsp;&nbsp;function SysUtils.FloatToText<br/>例子<br/>///////Begin CurrToStrF<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>begin<br/>&nbsp;&nbsp;Memo1.Lines.Values[&#39;ffGeneral&#39;] := CurrToStrF(StrToCurrDef(Edit1.Text, 0),<br/>&nbsp;&nbsp;&nbsp;&nbsp;ffGeneral, SpinEdit1.Value);<br/>&nbsp;&nbsp;Memo1.Lines.Values[&#39;ffExponent&#39;] := CurrToStrF(StrToCurrDef(Edit1.Text, 0),<br/>&nbsp;&nbsp;&nbsp;&nbsp;ffExponent, SpinEdit1.Value);<br/>&nbsp;&nbsp;Memo1.Lines.Values[&#39;ffFixed&#39;] := CurrToStrF(StrToCurrDef(Edit1.Text, 0),<br/>&nbsp;&nbsp;&nbsp;&nbsp;ffFixed, SpinEdit1.Value);<br/>&nbsp;&nbsp;Memo1.Lines.Values[&#39;ffNumber&#39;] := CurrToStrF(StrToCurrDef(Edit1.Text, 0),<br/>&nbsp;&nbsp;&nbsp;&nbsp;ffNumber, SpinEdit1.Value);<br/>&nbsp;&nbsp;Memo1.Lines.Values[&#39;ffCurrency&#39;] := CurrToStrF(StrToCurrDef(Edit1.Text, 0),<br/>&nbsp;&nbsp;&nbsp;&nbsp;ffCurrency, SpinEdit1.Value);<br/>end;<br/>///////End CurrToStrF<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function FloatToText(BufferArg: PChar; const Value; ValueType: TFloatValue; Format: TFloatFormat; Precision, Digits: Integer): Integer; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回浮点数以指定格式转换成指针字符串的内存大小<br/>说明&nbsp;&nbsp;Precision指定精度;Digits指定小数宽度<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子<br/>///////Begin FloatToText<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>var<br/>&nbsp;&nbsp;vBuffer: array[0..255] of Char;<br/>&nbsp;&nbsp;E: Extended;<br/>begin<br/>&nbsp;&nbsp;E := StrToFloatDef(Edit1.Text, 0);<br/>&nbsp;&nbsp;SpinEdit3.Value := FloatToText(vBuffer, E,<br/>&nbsp;&nbsp;&nbsp;&nbsp;fvExtended, ffNumber, SpinEdit1.Value, SpinEdit2.Value);<br/>&nbsp;&nbsp;Edit2.Text := Copy(vBuffer, 1, SpinEdit3.Value);<br/>end;<br/>///////End FloatToText(<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function FormatFloat(const Format: string; Value: Extended): string; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回浮点数类型以指定格式字符串Format转换成字符串<br/>说明&nbsp;&nbsp;FormatFloat(&#39;,.00&#39;, 1234567890) = &#39;1,234,567,890.00&#39;<br/>参考&nbsp;&nbsp;function SysUtils.FloatToTextFmt<br/>例子&nbsp;&nbsp;Edit1.Text := FormatFloat(Edit2.Text, StrToFloatDef(Edit3.Text, 0));<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function FormatCurr(const Format: string; Value: Currency): string; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回货币类型以指定格式字符串Format转换成字符串<br/>说明&nbsp;&nbsp;FormatCurr(&#39;,.00&#39;, 1234567890) = &#39;1,234,567,890.00&#39;<br/>参考&nbsp;&nbsp;function SysUtils.FloatToTextFmt<br/>例子&nbsp;&nbsp;Edit1.Text := FormatCurr(Edit2.Text, StrToCurrDef(Edit3.Text, 0));<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function FloatToTextFmt(Buf: PChar; const Value; ValueType: TFloatValue; Format: PChar): Integer; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回浮点数以指定格式字符串Format转换成指针字符串的内存大小<br/>说明&nbsp;&nbsp;ValueType指定无类型参数Value的类型<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子<br/>///////Begin FloatToTextFmt<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>var<br/>&nbsp;&nbsp;vBuffer: array[0..255] of Char;<br/>&nbsp;&nbsp;E: Extended;<br/>begin<br/>&nbsp;&nbsp;E := StrToFloatDef(Edit1.Text, 0);<br/>&nbsp;&nbsp;SpinEdit1.Value := FloatToTextFmt(vBuffer, E,<br/>&nbsp;&nbsp;&nbsp;&nbsp;fvExtended, PChar(Edit2.Text));<br/>&nbsp;&nbsp;Edit3.Text := Copy(vBuffer, 1, SpinEdit1.Value);<br/>end;<br/>///////End FloatToTextFmt<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function StrToFloat(const S: string): Extended; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回字符串S转换成浮点数<br/>说明&nbsp;&nbsp;字符串非浮点数表达时将引起异常<br/>参考&nbsp;&nbsp;function SysUtils.TextToFloat<br/>例子&nbsp;&nbsp;var E: Extended; begin E := StrToFloat(Edit1.Text); end;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function StrToFloatDef(const S: string; const Default: Extended): Extended; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回字符串S转换成浮点数<br/>说明&nbsp;&nbsp;字符串非浮点数表达时则返回默认值Default<br/>参考&nbsp;&nbsp;function SysUtils.TextToFloat<br/>例子&nbsp;&nbsp;var E: Extended; begin E := StrToFloatDef(Edit1.Text, 0); end;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function TryStrToFloat(const S: string; out Value: Extended): Boolean; overload; $[SysUtils.pas<br/>首部&nbsp;&nbsp;function TryStrToFloat(const S: string; out Value: Single): Boolean; overload; $[SysUtils.pas<br/>首部&nbsp;&nbsp;function TryStrToFloat(const S: string; out Value: Double): Boolean; overload; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回字符串S转换成浮点数Value是否成功<br/>说明&nbsp;&nbsp;字符串非浮点数表达时返回False并且Value将输出为不确定的值<br/>参考&nbsp;&nbsp;function SysUtils.TextToFloat<br/>例子<br/>///////Begin TryStrToFloat<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>var<br/>&nbsp;&nbsp;E: Extended;<br/>begin<br/>&nbsp;&nbsp;CheckBox1.Checked := TryStrToFloat(Edit1.Text, E);<br/>&nbsp;&nbsp;Edit2.Text := FormatFloat(&#39;&#39;, E);<br/>end;<br/>///////End TryStrToFloat<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function StrToCurr(const S: string): Currency; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回字符串S转换成货币数<br/>说明&nbsp;&nbsp;字符串非货币数表达时将引起异常<br/>参考&nbsp;&nbsp;function SysUtils.TextToFloat<br/>例子&nbsp;&nbsp;var C: Currency; begin C := StrToCurr(Edit1.Text); end;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function StrToCurrDef(const S: string; const Default: Currency): Currency; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回字符串S转换成货币数<br/>说明&nbsp;&nbsp;字符串非货币数表达时则返回默认值Default<br/>参考&nbsp;&nbsp;function SysUtils.TextToFloat<br/>例子&nbsp;&nbsp;var C: Currency; begin C := StrToCurrDef(Edit1.Text, 0); end;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function TryStrToCurr(const S: string; out Value: Currency): Boolean; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回字符串S转换成货币数Value是否成功<br/>说明&nbsp;&nbsp;字符串非货币数表达时返回False并且Value将输出为不确定的值<br/>参考&nbsp;&nbsp;function SysUtils.TextToFloat<br/>例子<br/>///////Begin TryStrToCurr<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>var<br/>&nbsp;&nbsp;C: Currency;<br/>begin<br/>&nbsp;&nbsp;CheckBox1.Checked := TryStrToCurr(Edit1.Text, C);<br/>&nbsp;&nbsp;Edit2.Text := FormatCurr(&#39;&#39;, C);<br/>end;<br/>///////End TryStrToCurr<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function TextToFloat(Buffer: PChar; var Value; ValueType: TFloatValue): Boolean; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回将指针字符串Buffer转换成无类型变量Value<br/>说明&nbsp;&nbsp;ValueType指定无类型参数Value的类型<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子<br/>///////Begin TextToFloat<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>var<br/>&nbsp;&nbsp;E: Extended;<br/>begin<br/>&nbsp;&nbsp;CheckBox1.Checked := TextToFloat(PChar(Edit1.Text), E,<br/>&nbsp;&nbsp;&nbsp;&nbsp;fvExtended);<br/>&nbsp;&nbsp;Edit2.Text := FormatFloat(&#39;&#39;, E);<br/>end;<br/>///////End TextToFloat<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;procedure FloatToDecimal(var Result: TFloatRec; const Value; ValueType: TFloatValue; Precision, Decimals: Integer); $[SysUtils.pas<br/>功能&nbsp;&nbsp;将浮点数转换成浮点结构类型并返回到Result<br/>说明&nbsp;&nbsp;ValueType指定类型recision指定精度;Decimals指定小数<br/>参考&nbsp;&nbsp;type SysUtils.TFloatRec<br/>例子&nbsp;&nbsp;&lt;NULL&gt;<br/>━━━━━━━━━━━━━━━━━━━━━&nbsp;&nbsp;<br/>首部&nbsp;&nbsp;function DateTimeToTimeStamp(DateTime: TDateTime): TTimeStamp; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回日期时间类型转换成时间结构类型<br/>说明&nbsp;&nbsp;&lt;NULL&gt;<br/>参考&nbsp;&nbsp;type SysUtils.TTimeStamp<br/>例子&nbsp;&nbsp;&lt;NULL&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function TimeStampToDateTime(const TimeStamp: TTimeStamp): TDateTime; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回时间结构类型转换成日期时间类型<br/>说明&nbsp;&nbsp;&lt;NULL&gt;<br/>参考&nbsp;&nbsp;type SysUtils.TTimeStamp<br/>例子&nbsp;&nbsp;&lt;NULL&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function MSecsToTimeStamp(MSecs: Comp): TTimeStamp; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回微妙转换成时间结构类型<br/>说明&nbsp;&nbsp;&lt;NULL&gt;<br/>参考&nbsp;&nbsp;type SysUtils.TTimeStamp<br/>例子&nbsp;&nbsp;&lt;NULL&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function TimeStampToMSecs(const TimeStamp: TTimeStamp): Comp; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回时间结构类型转换成微妙<br/>说明&nbsp;&nbsp;&lt;NULL&gt;<br/>参考&nbsp;&nbsp;type SysUtils.TTimeStamp<br/>例子&nbsp;&nbsp;&lt;NULL&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function EncodeDate(Year, Month, Day: Word): TDateTime; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回合并年、月、日得到的日期<br/>说明&nbsp;&nbsp;当出现非法组合时将触发异常<br/>参考&nbsp;&nbsp;function SysUtils.TryEncodeDate<br/>例子&nbsp;&nbsp;Edit1.Text := DateToStr(EncodeDate(SpinEdit1.Value, SpinEdit2.Value, SpinEdit3.Value));<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function EncodeTime(Hour, Min, Sec, MSec: Word): TDateTime; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回合并时、分、秒、微秒得到的时间<br/>说明&nbsp;&nbsp;当出现非法组合时将触发异常<br/>参考&nbsp;&nbsp;function SysUtils.TryEncodeTime<br/>例子&nbsp;&nbsp;Edit1.Text := TimeToStr(EncodeTime(SpinEdit1.Value, SpinEdit2.Value, SpinEdit3.Value, SpinEdit4.Value));<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function TryEncodeDate(Year, Month, Day: Word; out Date: TDateTime): Boolean; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回合并年、月、日得到的日期是否成功<br/>说明&nbsp;&nbsp;当出现非法组合时将返回False并且Date输出为0<br/>参考&nbsp;&nbsp;function SysUtils.IsLeapYear<br/>例子<br/>///////Begin TryEncodeDate<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>var<br/>&nbsp;&nbsp;vDate: TDate;<br/>begin<br/>&nbsp;&nbsp;CheckBox1.Checked := TryEncodeDate(SpinEdit1.Value, SpinEdit2.Value,<br/>&nbsp;&nbsp;&nbsp;&nbsp;SpinEdit3.Value, TDateTime(vDate));<br/>&nbsp;&nbsp;Edit1.Text := DateToStr(vDate);<br/>end;<br/>///////End TryEncodeDate<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function TryEncodeTime(Hour, Min, Sec, MSec: Word; out Time: TDateTime): Boolean; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回合并时、分、秒、微秒得到的时间是否成功<br/>说明&nbsp;&nbsp;当出现非法组合时将返回False并且Time输出为0<br/>参考&nbsp;&nbsp;const SysUtils.MSecsPerDay<br/>例子<br/>///////Begin TryEncodeTime<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>var<br/>&nbsp;&nbsp;vTime: TTime;<br/>begin<br/>&nbsp;&nbsp;CheckBox1.Checked := TryEncodeTime(SpinEdit1.Value, SpinEdit2.Value,<br/>&nbsp;&nbsp;&nbsp;&nbsp;SpinEdit3.Value, SpinEdit3.Value, TDateTime(vTime));<br/>&nbsp;&nbsp;Edit1.Text := TimeToStr(vTime);<br/>end;<br/>///////End TryEncodeTime<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;procedure DecodeDate(const DateTime: TDateTime; var Year, Month, Day: Word); $[SysUtils.pas<br/>功能&nbsp;&nbsp;分解日期为年、月、日<br/>说明&nbsp;&nbsp;&lt;NULL&gt;<br/>参考&nbsp;&nbsp;function SysUtils.DecodeDateFully<br/>例子<br/>///////Begin DecodeDate<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>var<br/>&nbsp;&nbsp;Year, Month, Day: Word;<br/>begin<br/>&nbsp;&nbsp;DecodeDate(Date, Year, Month, Day);<br/>&nbsp;&nbsp;SpinEdit1.Value := Year;<br/>&nbsp;&nbsp;SpinEdit2.Value := Month;<br/>&nbsp;&nbsp;SpinEdit3.Value := Day;<br/>end;<br/>///////End DecodeDate<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function DecodeDateFully(const DateTime: TDateTime; var Year, Month, Day, DOW: Word): Boolean; $[SysUtils.pas<br/>功能&nbsp;&nbsp;分解日期为年、月、日、星期<br/>说明&nbsp;&nbsp;[DOWay Of Week]<br/>参考&nbsp;&nbsp;function SysUtils.DateTimeToTimeStamp<br/>例子<br/>///////Begin DecodeDateFully<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>var<br/>&nbsp;&nbsp;Year, Month, Day, DOW: Word;<br/>begin<br/>&nbsp;&nbsp;DecodeDateFully(Date, Year, Month, Day, DOW);<br/>&nbsp;&nbsp;SpinEdit1.Value := Year;<br/>&nbsp;&nbsp;SpinEdit2.Value := Month;<br/>&nbsp;&nbsp;SpinEdit3.Value := Day;<br/>&nbsp;&nbsp;SpinEdit4.Value := DOW;<br/>end;<br/>///////End DecodeDateFully<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function InternalDecodeDate(const DateTime: TDateTime; var Year, Month, Day, DOW: Word): Boolean; $[SysUtils.pas<br/>功能&nbsp;&nbsp;&lt;NULL&gt;<br/>说明&nbsp;&nbsp;Kylix函数<br/>参考&nbsp;&nbsp;function SysUtils.DecodeDateFully<br/>例子&nbsp;&nbsp;&lt;NULL&gt;<br/>━━━━━━━━━━━━━━━━━━━━━&nbsp;&nbsp;<br/>首部&nbsp;&nbsp;procedure DecodeTime(const DateTime: TDateTime; var Hour, Min, Sec, MSec: Word); $[SysUtils.pas<br/>功能&nbsp;&nbsp;分解时间为时、分、秒、微妙<br/>说明&nbsp;&nbsp;&lt;NULL&gt;<br/>参考&nbsp;&nbsp;function SysUtils.DateTimeToTimeStamp<br/>例子<br/>///////Begin DecodeTime<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>var<br/>&nbsp;&nbsp;Hour, Min, Sec, MSec: Word;<br/>begin<br/>&nbsp;&nbsp;DecodeTime(Time, Hour, Min, Sec, MSec);<br/>&nbsp;&nbsp;SpinEdit1.Value := Hour;<br/>&nbsp;&nbsp;SpinEdit2.Value := Min;<br/>&nbsp;&nbsp;SpinEdit3.Value := Sec;<br/>&nbsp;&nbsp;SpinEdit4.Value := MSec;<br/>end;<br/>///////End DecodeTime<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;procedure DateTimeToSystemTime(const DateTime: TDateTime; var SystemTime: TSystemTime); $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回日期时间类型转换成系统时间类型<br/>说明&nbsp;&nbsp;&lt;NULL&gt;<br/>参考&nbsp;&nbsp;function SysUtils.DecodeDateFully;function SysUtils.DecodeTime<br/>例子&nbsp;&nbsp;&lt;NULL&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function SystemTimeToDateTime(const SystemTime: TSystemTime): TDateTime; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回系统时间类型转换成日期时间类型<br/>说明&nbsp;&nbsp;&lt;NULL&gt;<br/>参考&nbsp;&nbsp;function SysUtils.EncodeDate;function SysUtils.EncodeTime<br/>例子&nbsp;&nbsp;&lt;NULL&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function DayOfWeek(const DateTime: TDateTime): Word; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回日期时间DateTime所在的星期<br/>说明&nbsp;&nbsp;1(星期天),2(星期一),3(星期二),4(星期三),5(星期四),6(星期五),7(星期六)<br/>参考&nbsp;&nbsp;function SysUtils.DateTimeToTimeStamp<br/>例子&nbsp;&nbsp;<br/>///////Begin DayOfWeek<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>const<br/>&nbsp;&nbsp;cWeekCn: array[1..7] of string =<br/>(&#39;星期天&#39;, &#39;星期一&#39;, &#39;星期二&#39;, &#39;星期三&#39;, &#39;星期四&#39;, &#39;星期五&#39;, &#39;星期六&#39;);<br/>begin<br/>&nbsp;&nbsp;Edit1.Text := cWeekCn[DayOfWeek(Now)];<br/>end;<br/>///////End DayOfWeek<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function Date: TDateTime; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回当前日期<br/>说明&nbsp;&nbsp;Date - Int(Date)=0;<br/>参考&nbsp;&nbsp;function SysUtils.DateTimeToString<br/>例子&nbsp;&nbsp;Edit1.Text := DateToStr(Date);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function Time: TDateTime; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回当前时间<br/>说明&nbsp;&nbsp;Time - Frac(Time)=0;<br/>参考&nbsp;&nbsp;function Windows.GetLocalTime;function SysUtils.EncodeTime<br/>例子&nbsp;&nbsp;Edit1.Text := TimeToStr(Time);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function Now: TDateTime; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回当前日期时间<br/>说明&nbsp;&nbsp;Date + Time=Now<br/>参考&nbsp;&nbsp;function Windows.GetLocalTime;function SysUtils.EncodeDate;function SysUtils.EncodeTime<br/>例子&nbsp;&nbsp;Edit1.Text := DateTimeToStr(Now);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function CurrentYear: Word; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回当前年份<br/>说明&nbsp;&nbsp;&lt;NULL&gt;<br/>参考&nbsp;&nbsp;function Windows.GetLocalTime<br/>例子&nbsp;&nbsp;SpinEdit1.Value := CurrentYear;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function IncMonth(const DateTime: TDateTime; NumberOfMonths: Integer = 1): TDateTime; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回增加月份给日期<br/>说明&nbsp;&nbsp;NumberOfMonths为负数时则减月份<br/>参考&nbsp;&nbsp;procedure SysUtils.DecodeDate;procedure SysUtils.IncAMonth;function SysUtils.EncodeDate;procedure SysUtils.ReplaceTime<br/>例子&nbsp;&nbsp;DateTimePicker1.Date := IncMonth(Date, SpinEdit1.Value);<br/>━━━━━━━━━━━━━━━━━━━━━&nbsp;&nbsp;<br/>首部&nbsp;&nbsp;procedure IncAMonth(var Year, Month, Day: Word; NumberOfMonths: Integer = 1); $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回增加月份给年月日<br/>说明&nbsp;&nbsp;NumberOfMonths为负数时则减月份<br/>参考&nbsp;&nbsp;procedure System.Inc<br/>例子<br/>///////Begin IncAMonth<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>var<br/>&nbsp;&nbsp;vYear, vMonth, vDay: Word;<br/>begin<br/>&nbsp;&nbsp;DecodeDate(Date, vYear, vMonth, vDay);<br/>&nbsp;&nbsp;IncAMonth(vYear, vMonth, vDay, SpinEdit1.Value);<br/>&nbsp;&nbsp;DateTimePicker1.Date := EncodeDate(vYear, vMonth, vDay);<br/>end;<br/>///////End IncAMonth<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;procedure ReplaceTime(var DateTime: TDateTime; const NewTime: TDateTime); $[SysUtils.pas<br/>功能&nbsp;&nbsp;用时间NewTime替换日期时间DateTime的时间部分<br/>说明&nbsp;&nbsp;Int(DateTime) + Frac(NewTime)<br/>参考&nbsp;&nbsp;function System.Trunc;function System.Abs;function System.Frac<br/>例子<br/>///////Begin ReplaceTime<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>var<br/>&nbsp;&nbsp;vDateTime: TDateTime;<br/>begin<br/>&nbsp;&nbsp;vDateTime := Now;<br/>&nbsp;&nbsp;ReplaceTime(vDateTime, DateTimePicker1.Time);<br/>&nbsp;&nbsp;Edit1.Text := DateTimeToStr(vDateTime);<br/>end;<br/>///////End ReplaceTime<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;procedure ReplaceDate(var DateTime: TDateTime; const NewDate: TDateTime); $[SysUtils.pas<br/>功能&nbsp;&nbsp;用日期NewDate替换日期时间DateTime的日期部分<br/>说明&nbsp;&nbsp;Int(NewTime) + Frac(DateTime)<br/>参考&nbsp;&nbsp;procedure SysUtils.ReplaceTime<br/>例子<br/>///////Begin ReplaceDate<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>var<br/>&nbsp;&nbsp;vDateTime: TDateTime;<br/>begin<br/>&nbsp;&nbsp;vDateTime := Now;<br/>&nbsp;&nbsp;ReplaceDate(vDateTime, DateTimePicker1.Date);<br/>&nbsp;&nbsp;Edit1.Text := DateTimeToStr(vDateTime);<br/>end;<br/>///////End ReplaceDate<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function IsLeapYear(Year: Word): Boolean; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回年份Year是否是闰年<br/>说明&nbsp;&nbsp;(Year mod 4 = 0) and ((Year mod 100 &lt;&gt; 0) o&#114; (Year mod 400 = 0))<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子&nbsp;&nbsp;CheckBox1.Checked := IsLeapYear(SpinEdit1.Value);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function DateToStr(const DateTime: TDateTime): string; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回日期DateTime转换成字符串<br/>说明&nbsp;&nbsp;转换格式由系统变量ShortDateFormat控制<br/>参考&nbsp;&nbsp;function SysUtils.DateTimeToString;var SysUtils.ShortDateFormat<br/>例子&nbsp;&nbsp;Edit1.Text := DateToStr(Date);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function TimeToStr(const DateTime: TDateTime): string; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回时间DateTime转换成字符串<br/>说明&nbsp;&nbsp;转换格式由系统变量LongTimeFormat控制<br/>参考&nbsp;&nbsp;function SysUtils.DateTimeToString;var SysUtils.LongTimeFormat<br/>例子&nbsp;&nbsp;Edit1.Text := TimeToStr(Date);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function DateTimeToStr(const DateTime: TDateTime): string; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回日期时间DateTime转换成字符串<br/>说明&nbsp;&nbsp;转换格式由系统变量ShortDateFormat和LongTimeFormat控制<br/>参考&nbsp;&nbsp;function SysUtils.DateTimeToString<br/>例子&nbsp;&nbsp;Edit1.Text := DateTimeToStr(Now);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function StrToDate(const S: string): TDateTime; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回字符串S转换成日期<br/>说明&nbsp;&nbsp;字符非日期表达时将引起异常<br/>参考&nbsp;&nbsp;function SysUtils.TryStrToDate<br/>例子&nbsp;&nbsp;DateTimePicker1.Date := StrToDate(Edit1.Text);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function StrToDateDef(const S: string; const Default: TDateTime): TDateTime; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回字符串S转换成日期<br/>说明&nbsp;&nbsp;字符非日期表达时则返回默认值Default<br/>参考&nbsp;&nbsp;function SysUtils.TryStrToDate<br/>例子&nbsp;&nbsp;DateTimePicker1.Date := StrToDateDef(Edit1.Text, Date);<br/>━━━━━━━━━━━━━━━━━━━━━]]></description>
		</item>
		
			<item>
			<link>http://www.zjidea.com/blog/article/delphi/20091211_delphi_function2.htm</link>
			<title><![CDATA[Delphi函数大全2]]></title>
			<author>lzq0323@yahoo.com.cn(相逢萍水)</author>
			<category><![CDATA[Delphi编程]]></category>
			<pubDate>Fri,11 Dec 2009 13:10:50 +0800</pubDate>
			<guid>http://www.zjidea.com/blog/default.asp?id=457</guid>
		<description><![CDATA[首部&nbsp;&nbsp;function FileGetDate(Handle: Integer): Integer; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回文件的修改时间<br/>说明&nbsp;&nbsp;读取失败则返回-1<br/>参考&nbsp;&nbsp;function Windows.GetFileTime<br/>例子<br/>///////Begin FileGetDate<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>var<br/>&nbsp;&nbsp;I: Integer;<br/>begin<br/>&nbsp;&nbsp;I := FileOpen(Edit1.Text, fmOpenRead);<br/>&nbsp;&nbsp;if I &lt; 0 then Exit;<br/>&nbsp;&nbsp;SpinEdit1.Value := FileGetDate(I);<br/>&nbsp;&nbsp;Edit2.Text := DateTimeToStr(FileDateToDateTime(SpinEdit1.Value));<br/>&nbsp;&nbsp;FileClose(I);<br/>end;<br/>///////End FileGetDate<br/>━━━━━━━━━━━━━━━━━━━━━ <br/>首部&nbsp;&nbsp;function FileSetDate(const FileName: string; Age: Integer): Integer; overload; $[SysUtils.pas<br/>首部&nbsp;&nbsp;function FileSetDate(Handle: Integer; Age: Integer): Integer; overload; platform; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回设置文件的修改时间<br/>说明&nbsp;&nbsp;修改成功则返回0<br/>参考&nbsp;&nbsp;function Windows.SetFileTime<br/>例子&nbsp;&nbsp;SpinEdit1.Value := FileSetDate(Edit1.Text, DateTimeToFileDate(StrToDateTime(Edit2.Text)));<br/>━━━━━━━━━━━━━━━━━━━━━&nbsp;&nbsp;<br/>首部&nbsp;&nbsp;function FileGetAttr(const FileName: string): Integer; platform; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回文件的属性<br/>说明&nbsp;&nbsp;读取失败则返回$FFFFFFFF<br/>参考&nbsp;&nbsp;function Windows.GetFileAttributes<br/>例子&nbsp;&nbsp;SpinEdit1.Value := FileGetAttr(Edit1.Text);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function FileSetAttr(const FileName: string; Attr: Integer): Integer; platform; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回设置文件的属性<br/>说明&nbsp;&nbsp;设置成功则返回0<br/>参考&nbsp;&nbsp;function Windows.SetFileAttributes<br/>例子&nbsp;&nbsp;SpinEdit1.Value := FileSetAttr(Edit1.Text, SpinEdit2.Value);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function FileIsReadOnly(const FileName: string): Boolean; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回文件是否只读<br/>说明&nbsp;&nbsp;文件不存在看作只读<br/>参考&nbsp;&nbsp;function Windows.GetFileAttributes<br/>例子&nbsp;&nbsp;CheckBox1.Checked := FileIsReadOnly(Edit1.Text);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function FileSetReadOnly(const FileName: string; ReadOnly: Boolean): Boolean; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回设置文件是否只读是否成功<br/>说明&nbsp;&nbsp;文件不存在则返回False<br/>参考&nbsp;&nbsp;function Windows.GetFileAttributes;function Windows.SetFileAttributes<br/>例子&nbsp;&nbsp;CheckBox1.Checked := FileSetReadOnly(Edit1.Text, CheckBox2.Checked);<br/>━━━━━━━━━━━━━━━━━━━━━&nbsp;&nbsp;<br/>首部&nbsp;&nbsp;function Del&#101;teFile(const FileName: string): Boolean; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回删除文件是否成功<br/>说明&nbsp;&nbsp;文件不存在则返回False<br/>参考&nbsp;&nbsp;function Windows.Del&#101;teFile<br/>例子&nbsp;&nbsp;CheckBox1.Checked := Del&#101;teFile(Edit1.Text);<br/>━━━━━━━━━━━━━━━━━━━━━&nbsp;&nbsp;<br/>首部&nbsp;&nbsp;function RenameFile(const OldName, NewName: string): Boolean; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回重命名文件是否成功<br/>说明&nbsp;&nbsp;文件不存在则返回False<br/>参考&nbsp;&nbsp;function Windows.MoveFile<br/>例子&nbsp;&nbsp;CheckBox1.Checked := RenameFile(Edit1.Text, Edit2.Text);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function ChangeFileExt(const FileName, Extension: string): string; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回改变扩展名后的文件名<br/>说明&nbsp;&nbsp;[注意]扩展名Extension前要加点;ChangeFileExt(&#39;a.jpg&#39;, &#39;bmp&#39;)=&#39;abmp&#39;<br/>参考&nbsp;&nbsp;function SysUtils.LastDelimiter;function System.Copy<br/>例子&nbsp;&nbsp;Edit1.Text := ChangeFileExt(Edit2.Text, Edit3.Text);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function ExtractFilePath(const FileName: string): string; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回文件名所在的路径<br/>说明&nbsp;&nbsp;ExtractFilePath(&#39;C:\&#39;)=&#39;C:\&#39;;ExtractFilePath(&#39;\\Server\Tool\Calc.exe&#39;)=&#39;\\Server\Tool\&#39;<br/>参考&nbsp;&nbsp;function SysUtils.LastDelimiter;function System.Copy<br/>例子&nbsp;&nbsp;Edit1.Text := ExtractFilePath(Edit2.Text);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function ExtractFileDir(const FileName: string): string; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回文件名所在的目录<br/>说明&nbsp;&nbsp;ExtractFileDir(&#39;C:\&#39;)=&#39;C:\&#39;;ExtractFileDir(&#39;\\Server\Tool\Calc.exe&#39;)=&#39;\\Server\Tool&#39;<br/>参考&nbsp;&nbsp;function SysUtils.LastDelimiter;function System.Copy<br/>例子&nbsp;&nbsp;Edit1.Text := ExtractFileDir(Edit2.Text);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function ExtractFileDrive(const FileName: string): string; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回文件名所在驱动器<br/>说明&nbsp;&nbsp;ExtractFileDrive(&#39;C:\&#39;)=&#39;C:&#39;;ExtractFileDrive(&#39;\\Server\Tool\Calc.exe&#39;)=&#39;\\Server\Tool&#39;<br/>参考&nbsp;&nbsp;function System.Copy<br/>例子&nbsp;&nbsp;Edit1.Text := ExtractFileDrive(Edit2.Text);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function ExtractFileName(const FileName: string): string; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回绝对文件名<br/>说明&nbsp;&nbsp;ExtractFileName(&#39;C:\&#39;)=&#39;&#39;;ExtractFileName(&#39;\\Server\Tool\Calc.exe&#39;)=&#39;Calc.exe&#39;<br/>参考&nbsp;&nbsp;function SysUtils.LastDelimiter;function System.Copy<br/>例子&nbsp;&nbsp;Edit1.Text := ExtractFileName(Edit2.Text);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function ExtractFileExt(const FileName: string): string; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回文件名的扩展名<br/>说明&nbsp;&nbsp;ExtractFileExt(&#39;C:\&#39;)=&#39;&#39;;ExtractFileExt(&#39;\\Server\Tool\Calc.exe&#39;)=&#39;.exe&#39;<br/>参考&nbsp;&nbsp;function SysUtils.LastDelimiter;function System.Copy<br/>例子&nbsp;&nbsp;Edit1.Text := ExtractFileExt(Edit2.Text);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function ExpandFileName(const FileName: string): string; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回文件名的完整表示<br/>说明&nbsp;&nbsp;ExpandFileName(&#39;hello.pas&#39;)=&#39;C:\Program Files\Borland\Delphi6\Projects\hello.pas&#39;<br/>参考&nbsp;&nbsp;function Windows.GetFullPathName<br/>例子&nbsp;&nbsp;Edit1.Text := ExpandFileName(Edit2.Text);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function ExpandFileNameCase(const FileName: string; out MatchFound: TFilenameCaseMatch): string; $[SysUtils.pas<br/>功能&nbsp;&nbsp;分情况返回文件名的完整表示<br/>说明&nbsp;&nbsp;type TFilenameCaseMatch = (mkNone, mkExactMatch, mkSingleMatch, mkAmbiguous);<br/>参考&nbsp;&nbsp;function Windows.GetFullPathName;function SysUtils.SameFileName;function SysUtils.FindFirst<br/>例子<br/>///////Begin ExpandFileNameCase<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>var<br/>&nbsp;&nbsp;vFilenameCaseMatch: TFilenameCaseMatch;<br/>begin<br/>&nbsp;&nbsp;Edit1.Text := ExpandFileNameCase(Edit2.Text, vFilenameCaseMatch);<br/>&nbsp;&nbsp;SpinEdit1.Value := o&#114;d(vFilenameCaseMatch);<br/>end;<br/>///////End ExpandFileNameCase<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function ExpandUNCFileName(const FileName: string): string; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回LINUX文件名的完整表示<br/>说明&nbsp;&nbsp;ExpandUNCFileName(&#39;C:/&#39;)=&#39;C:\&#39;<br/>参考&nbsp;&nbsp;function SysUtils.ExpandFileName<br/>例子&nbsp;&nbsp;Edit1.Text := ExpandUNCFileName(Edit2.Text);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function ExtractRelativePath(const BaseName, DestName: string): string; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回参数的相对路径<br/>说明&nbsp;&nbsp;ExtractRelativePath(&#39;C:\Windows\&#39;, &#39;C:\Windows\System&#39;)=&#39;System&#39;<br/>参考&nbsp;&nbsp;function SysUtils.SameFilename;function SysUtils.ExtractFileDrive<br/>例子&nbsp;&nbsp;Edit1.Text := ExtractRelativePath(Edit2.Text, Edit3.Text);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function ExtractShortPathName(const FileName: string): string; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回参数的DOS路径<br/>说明&nbsp;&nbsp;ExtractShortPathName(&#39;C:\Program Files\Borland&#39;)=&#39;C:\PROGRA~1\BORLAND&#39;<br/>参考&nbsp;&nbsp;function Windows.GetShortPathName<br/>例子&nbsp;&nbsp;Edit1.Text := ExtractShortPathName(Edit2.Text);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function FileSearch(const Name, DirList: string): string; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回目录列表中DirList搜索的第一个结果<br/>说明&nbsp;&nbsp;FileSearch(&#39;Calc.exe&#39;, &#39;d:\winxp\system32;c:\windows&#39;)=&#39;d:\winxp\system32\calc.exe&#39;<br/>参考&nbsp;&nbsp;function SysUtils.FileExists;function SysUtils.AnsiLastChar<br/>例子&nbsp;&nbsp;Edit1.Text := FileSearch(Edit2.Text, Edit3.Text);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function DiskFree(Drive: Byte): Int64; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回驱动器可用空间<br/>说明&nbsp;&nbsp;参数Drive为0表示当前路径,为1表示=A驱,为2表示=B驱...;获取失败则返回-1<br/>参考&nbsp;&nbsp;function Windows.GetDiskFreeSpaceExA<br/>例子&nbsp;&nbsp;SpinEdit1.Value := DiskFree(SpinEdit2.Value);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function DiskSize(Drive: Byte): Int64; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回驱动器全?*占?br /&gt; 说明&nbsp;&nbsp;参数Drive为0表示当前路径,为1表示=A驱,为2表示=B驱...;获取失败则返回-1<br/>参考&nbsp;&nbsp;function Windows.GetDiskFreeSpaceExA<br/>例子&nbsp;&nbsp;SpinEdit1.Value := DiskSize(SpinEdit2.Value);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function FileDateToDateTime(FileDate: Integer): TDateTime; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回将文件日期时间类型转换日期时间类型<br/>说明&nbsp;&nbsp;FileDate非法是将触发异常<br/>参考&nbsp;&nbsp;function SysUtils.EncodeDate;function SysUtils.EncodeTime<br/>例子&nbsp;&nbsp;&lt;参见FileAge&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function DateTimeToFileDate(DateTime: TDateTime): Integer; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回将日期时间类型转换文件日期时间类型<br/>说明&nbsp;&nbsp;年份在1980到2107之外则返回0<br/>参考&nbsp;&nbsp;function SysUtils.DecodeDate;function SysUtils.DecodeTime<br/>例子&nbsp;&nbsp;&lt;参见FileSetDate&gt;<br/>━━━━━━━━━━━━━━━━━━━━━&nbsp;&nbsp;<br/>首部&nbsp;&nbsp;function GetCurrentDir: string; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回当前操作目录<br/>说明&nbsp;&nbsp;[注意]调用文件对话框会改变当前操作目录<br/>参考&nbsp;&nbsp;function System.GetDir<br/>例子&nbsp;&nbsp;Edit1.Text := GetCurrentDir;<br/>━━━━━━━━━━━━━━━━━━━━━&nbsp;&nbsp;<br/>首部&nbsp;&nbsp;function SetCurrentDir(const Dir: string): Boolean; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回设置当前操作目录是否成功<br/>说明&nbsp;&nbsp;[注意]调用文件对话框会改变当前操作目录<br/>参考&nbsp;&nbsp;function Windows.SetCurrentDirectory<br/>例子&nbsp;&nbsp;CheckBox1.Checked := SetCurrentDir(Edit1.Text);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function Cr&#101;ateDir(const Dir: string): Boolean; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回创建目录是否成功<br/>说明&nbsp;&nbsp;不支持多级目录;已经存在则返回False<br/>参考&nbsp;&nbsp;function Windows.Cr&#101;ateDirectory<br/>例子&nbsp;&nbsp;CheckBox1.Checked := Cr&#101;ateDir(Edit1.Text);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function RemoveDir(const Dir: string): Boolean; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回删除目录是否成功<br/>说明&nbsp;&nbsp;必须是空目录<br/>参考&nbsp;&nbsp;function Windows.RemoveDirectory<br/>例子&nbsp;&nbsp;CheckBox1.Checked := RemoveDir(Edit1.Text);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function StrLen(const Str: PChar): Cardinal; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回指针字符串的长度<br/>说明&nbsp;&nbsp;当指针字符串Str为nil时将触发异常<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子&nbsp;&nbsp;SpinEdit2.Value := StrLen(PChar(Edit1.Text));<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function StrEnd(const Str: PChar): PChar; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回指针字符串的结尾<br/>说明&nbsp;&nbsp;当指针字符串Str为nil时将触发异常<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子&nbsp;&nbsp;Edit2.Text := StrEnd(PChar(Edit1.Text)) - SpinEdit1.Value;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function StrMove(Dest: PChar; const Source: PChar; Count: Cardinal): PChar; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回将指针字符串Source指定内存数量Count复制覆盖到指针字符串Dest中<br/>说明&nbsp;&nbsp;Dest没有分配资源将触发异常s<br/>参考&nbsp;&nbsp;function System.Move<br/>例子<br/>///////Begin StrMove<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>var<br/>&nbsp;&nbsp;vBuffer: PChar;<br/>begin<br/>&nbsp;&nbsp;vBuffer := &#39;0123456789&#39;;<br/>&nbsp;&nbsp;StrMove(vBuffer, PChar(Edit1.Text), SpinEdit1.Value);<br/>&nbsp;&nbsp;Edit2.Text := vBuffer;<br/>end;<br/>///////End StrMove<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function StrCopy(Dest: PChar; const Source: PChar): PChar; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回将指针字符串Source复制到指针字符串Dest中<br/>说明&nbsp;&nbsp;Dest应已经分配足够的空间非则将触发异常<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子<br/>///////Begin StrCopy<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>var<br/>&nbsp;&nbsp;vBuffer: PChar;<br/>begin<br/>&nbsp;&nbsp;GetMem(vBuffer, Length(Edit1.Text) + 1);<br/>&nbsp;&nbsp;StrCopy(vBuffer, PChar(Edit1.Text));<br/>&nbsp;&nbsp;Edit2.Text := vBuffer;<br/>&nbsp;&nbsp;FreeMem(vBuffer);<br/>end;<br/>///////End StrCopy<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function StrECopy(DestChar; const Source: PChar): PChar; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回将指针字符串Source复制到指针字符串Dest中的结尾<br/>说明&nbsp;&nbsp;可以连接指针字符串<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子<br/>///////Begin StrECopy<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>var<br/>&nbsp;&nbsp;vBuffer: array[0..255] of Char;<br/>begin<br/>&nbsp;&nbsp;StrECopy(StrECopy(vBuffer, PChar(Edit1.Text)), PChar(Edit2.Text));<br/>&nbsp;&nbsp;Edit3.Text := vBuffer;<br/>end;<br/>///////End StrECopy<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function StrLCopy(Dest: PChar; const Source: PChar; MaxLen: Cardinal): PChar; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回将指针字符串Source指定长度MaxLen复制到指针字符串Dest中<br/>说明&nbsp;&nbsp;Dest应已经分配足够的空间非则将触发异常<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子<br/>///////Begin StrLCopy<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>var<br/>&nbsp;&nbsp;vBuffer: array[0..255] of Char;<br/>begin<br/>&nbsp;&nbsp;StrLCopy(vBuffer, PChar(Edit1.Text), SpinEdit1.Value);<br/>&nbsp;&nbsp;Edit2.Text := vBuffer;<br/>end;<br/>///////End StrLCopy<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function StrPCopy(Dest: PChar; const Source: string): PChar; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回将指针字符串Source复制到指针字符串Dest中<br/>说明&nbsp;&nbsp;StrLCopy(Dest, PChar(Source), Length(Source))<br/>参考&nbsp;&nbsp;function SysUtils.StrLCopy<br/>例子<br/>///////Begin StrPCopy<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>var<br/>&nbsp;&nbsp;vBuffer: array[0..255] of Char;<br/>begin<br/>&nbsp;&nbsp;StrPCopy(vBuffer, PChar(Edit1.Text));<br/>&nbsp;&nbsp;Edit2.Text := vBuffer;<br/>end;<br/>///////End StrPCopy<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function StrPLCopy(Dest: PChar; const Source: string; MaxLen: Cardinal): PChar; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回将字符串Source指定长度MaxLen复制到指针字符串Dest中<br/>说明&nbsp;&nbsp;StrLCopy(Dest, PChar(Source), MaxLen)<br/>参考&nbsp;&nbsp;function SysUtils.StrLCopy<br/>例子<br/>///////Begin StrPLCopy<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>var<br/>&nbsp;&nbsp;vBuffer: array[0..255] of Char;<br/>begin<br/>&nbsp;&nbsp;StrPLCopy(vBuffer, Edit1.Text, SpinEdit1.Value);<br/>&nbsp;&nbsp;Edit2.Text := vBuffer;<br/>end;<br/>///////End StrPLCopy<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function StrCat(Dest: PChar; const Source: PChar): PChar; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回连接指针字符串Dest和指针字符串Source<br/>说明&nbsp;&nbsp;StrCopy(StrEnd(Dest), Source)<br/>参考&nbsp;&nbsp;function SysUntils.StrCopy<br/>例子<br/>///////Begin StrCat<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>var<br/>&nbsp;&nbsp;vBuffer: array[0..255] of Char;<br/>begin<br/>&nbsp;&nbsp;StrPCopy(vBuffer, Edit1.Text);<br/>&nbsp;&nbsp;StrCat(vBuffer, PChar(Edit2.Text));<br/>&nbsp;&nbsp;Edit3.Text := vBuffer;<br/>end;<br/>///////End StrCat<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function StrLCat(Dest: PChar; const Source: PChar; MaxLen: Cardinal): PChar; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回连接指针字符串Dest和指针字符串Source<br/>说明&nbsp;&nbsp;[注意]MaxLen指定连接后的最大长度不是指针字符串Source的长度<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子<br/>///////Begin StrLCat<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>var<br/>&nbsp;&nbsp;vBuffer: array[0..255] of Char;<br/>begin<br/>&nbsp;&nbsp;StrPCopy(vBuffer, Edit1.Text);<br/>&nbsp;&nbsp;StrLCat(vBuffer, PChar(Edit2.Text), SpinEdit1.Value);<br/>&nbsp;&nbsp;Edit3.Text := vBuffer;<br/>end;<br/>///////End StrLCat<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function StrComp(const Str1, Str2: PChar): Integer; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回比较两个指针字符串<br/>说明&nbsp;&nbsp;当S1&gt;S2返回值&gt;0;当S1&lt;S2返回值&lt;0;当S1=S2返回值=0;区分大小写;[注意]返回第一个出现不同字符的差异<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子&nbsp;&nbsp;SpinEdit1.Value := StrComp(PChar(Edit1.Text), PChar(Edit2.Text));<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function StrIComp(const Str1, Str2: PChar): Integer; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回比较两个指针字符串<br/>说明&nbsp;&nbsp;当S1&gt;S2返回值&gt;0;当S1&lt;S2返回值&lt;0;当S1=S2返回值=0;不区分大小写;[注意]返回第一个出现不同字符的差异<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子&nbsp;&nbsp;SpinEdit1.Value := StrIComp(PChar(Edit1.Text), PChar(Edit2.Text));<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function StrLComp(const Str1, Str2: PChar; MaxLen: Cardinal): Integer; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回比较两个指针字符串指定长度<br/>说明&nbsp;&nbsp;当S1&gt;S2返回值&gt;0;当S1&lt;S2返回值&lt;0;当S1=S2返回值=0;区分大小写;Length(长度);[注意]返回第一个出现不同字符的差异<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子&nbsp;&nbsp;SpinEdit1.Value := StrLComp(PChar(Edit1.Text), PChar(Edit2.Text), SpinEdit2.Value)<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function StrLIComp(const Str1, Str2: PChar; MaxLen: Cardinal): Integer; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回比较两个指针字符串指定长度<br/>说明&nbsp;&nbsp;当S1&gt;S2返回值&gt;0;当S1&lt;S2返回值&lt;0;当S1=S2返回值=0;不区分大小写;[注意]返回第一个出现不同字符的差异<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子&nbsp;&nbsp;SpinEdit1.Value := StrLIComp(PChar(Edit1.Text), PChar(Edit2.Text), SpinEdit2.Value)<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function StrScan(const Str: PChar; Chr: Char): PChar; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回在指针字符串Str搜索字符Chr第一个出现的地址<br/>说明&nbsp;&nbsp;没有找到则返回空指针<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子&nbsp;&nbsp;Edit2.Text := StrScan(PChar(Edit1.Text), &#39;*&#39;);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function StrRScan(const Str: PChar; Chr: Char): PChar; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回在指针字符串Str搜索字符Chr最后一个出现的地址<br/>说明&nbsp;&nbsp;没有找到则返回空指针<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子&nbsp;&nbsp;Edit2.Text := StrRScan(PChar(Edit1.Text), &#39;*&#39;);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function StrPos(const Str1, Str2: PChar): PChar; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回指针字符串Str2在Str1中第一个出现的地址<br/>说明&nbsp;&nbsp;没有找到则返回空指针;StrPos(&#39;12345&#39;, &#39;3&#39;) = &#39;345&#39;<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子&nbsp;&nbsp;Edit3.Text := StrPos(PChar(Edit1.Text), PChar(Edit2.Text));<br/>━━━━━━━━━━━━━━━━━━━━━&nbsp;&nbsp;<br/>首部&nbsp;&nbsp;function StrUpper(Str: PChar): PChar; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回指针字符串Str大写<br/>说明&nbsp;&nbsp;非小写字符不处理<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子&nbsp;&nbsp;Edit1.Text := StrUpper(PChar(Edit2.Text));<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function StrLower(Str: PChar): PChar; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回指针字符串Str小写<br/>说明&nbsp;&nbsp;非大写字符不处理<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子&nbsp;&nbsp;Edit1.Text := StrLower(PChar(Edit2.Text)); <br/>━━━━━━━━━━━━━━━━━━━━━&nbsp;&nbsp;<br/>首部&nbsp;&nbsp;function StrPas(const Str: PChar): string; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回指针字符串Str转换成字符串<br/>说明&nbsp;&nbsp;也可以直接赋值<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子&nbsp;&nbsp;Edit1.Text := StrPas(PChar(Edit2.Text));<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function StrAlloc(Size: Cardinal): PChar; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回分配指定空间的内存资源给指针字符串<br/>说明&nbsp;&nbsp;空间的大小也将保存;用StrDispose才能全部释放<br/>参考&nbsp;&nbsp;function System.GetMem<br/>例子<br/>///////Begin StrAlloc<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>var<br/>&nbsp;&nbsp;P: PChar;<br/>begin<br/>&nbsp;&nbsp;P := StrAlloc(SpinEdit1.Value);<br/>&nbsp;&nbsp;ShowMessage(IntToStr(StrLen(P)));<br/>&nbsp;&nbsp;Dec(P, SizeOf(Cardinal));<br/>&nbsp;&nbsp;ShowMessage(IntToStr(Cardinal(Pointer(P)^)));<br/>&nbsp;&nbsp;Inc(P, SizeOf(Cardinal));<br/>&nbsp;&nbsp;StrDispose(P);<br/>end;<br/>///////End StrAlloc<br/><br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function StrBufSize(const Str: PChar): Cardinal; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回通过函数StrAlloc分配的缓冲区大小<br/>说明&nbsp;&nbsp;出现异常情况则返回不可预知的结果<br/>参考&nbsp;&nbsp;function System.SizeOf<br/>例子&nbsp;&nbsp;SpinEdit1.Value := StrBufSize(StrAlloc(SpinEdit2.Value));<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function StrNew(const Str: PChar): PChar; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回复制一个新的指针字符串<br/>说明&nbsp;&nbsp;如果Str为nil则返回nil<br/>参考&nbsp;&nbsp;function SysUtils.StrLen;function SysUtils.StrMove;function SysUtils.StrAlloc<br/>例子<br/>///////Begin StrNew,StrDispose<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>var<br/>&nbsp;&nbsp;P: PChar;<br/>begin<br/>&nbsp;&nbsp;P := StrNew(PChar(Edit1.Text));<br/>&nbsp;&nbsp;ShowMessage(P);<br/>&nbsp;&nbsp;StrDispose(P);<br/>end;<br/>///////End StrNew,StrDispose<br/>━━━━━━━━━━━━━━━━━━━━━<br/>]]></description>
		</item>
		
			<item>
			<link>http://www.zjidea.com/blog/article/delphi/20091211_delphi_function1.htm</link>
			<title><![CDATA[Delphi函数大全1]]></title>
			<author>lzq0323@yahoo.com.cn(相逢萍水)</author>
			<category><![CDATA[Delphi编程]]></category>
			<pubDate>Fri,11 Dec 2009 13:07:31 +0800</pubDate>
			<guid>http://www.zjidea.com/blog/default.asp?id=456</guid>
		<description><![CDATA[转载Delphi函数大全,与大家共享!<br/><br/>首部&nbsp;&nbsp;function Languages: TLanguages; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回系统语言对象<br/>说明&nbsp;&nbsp;通过此函数可以得到系统的语言环境<br/>参考&nbsp;&nbsp;type SysUtils.TLanguages<br/>例子&nbsp;&nbsp;<br/>///////Begin Languages<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>var<br/>&nbsp;&nbsp;I: Integer;<br/>begin<br/>&nbsp;&nbsp;Memo1.Clear;<br/>&nbsp;&nbsp;for I := 0 to Languages.Count - 1 do<br/>&nbsp;&nbsp;&nbsp;&nbsp;Memo1.Lines.Add(Languages.Name[I]);<br/>end;<br/>///////End Languages<br/>━━━━━━━━━━━━━━━━━━━━━&nbsp;&nbsp;<br/>首部&nbsp;&nbsp;function AllocMem(Size: Cardinal): Pointer; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回一个指定大小Size的内存块<br/>说明&nbsp;&nbsp;配合用FreeMem释放资源<br/>参考&nbsp;&nbsp;function System.GetMem<br/>例子&nbsp;&nbsp;<br/>///////Begin AllocMem<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>var<br/>&nbsp;&nbsp;I: PInteger;<br/>begin<br/>&nbsp;&nbsp;I := AllocMem(SizeOf(Integer));<br/>&nbsp;&nbsp;I^ := 100;<br/>&nbsp;&nbsp;Edit1.Text := IntToStr(I^);<br/>&nbsp;&nbsp;FreeMem(I, SizeOf(Integer));<br/>end;<br/>///////End AllocMem<br/>━━━━━━━━━━━━━━━━━━━━━&nbsp;&nbsp;<br/>首部&nbsp;&nbsp;procedure AddExitProc(Proc: TProcedure); $[SysUtils.pas<br/>功能&nbsp;&nbsp;添加一个退出处理的过程<br/>说明&nbsp;&nbsp;建议用finalization部分取代<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子&nbsp;&nbsp;<br/>////////Begin AddExitProc<br/>uses<br/>&nbsp;&nbsp;ShellApi;<br/><br/>procedure ExitProc;<br/>begin<br/>&nbsp;&nbsp;ShellExecute(0, &#39;Open&#39;, &#39;Calc.exe&#39;, nil, nil, SW_SHOW);<br/>end;<br/><br/>procedure TForm1.Button1Click(Sender: TObject);<br/>begin<br/>&nbsp;&nbsp;AddExitProc(ExitProc);<br/>end;<br/>////////End AddExitProc<br/>━━━━━━━━━━━━━━━━━━━━━&nbsp;&nbsp;<br/>首部&nbsp;&nbsp;function NewStr(const S: string): PString; deprecated; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回一个新的字符串指针地址<br/>说明&nbsp;&nbsp;字符串S为空时返回NullStr<br/>参考&nbsp;&nbsp;procedure System.New<br/>例子&nbsp;&nbsp;<br/>////////Begin NewStr,DisposeStr<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>var<br/>&nbsp;&nbsp;P: PString;<br/>begin<br/>&nbsp;&nbsp;P := NewStr(Edit1.Text);<br/>&nbsp;&nbsp;Edit2.Text := P^;<br/>&nbsp;&nbsp;DisposeStr(P);<br/>end;<br/>////////End NewStr,DisposeStr<br/>━━━━━━━━━━━━━━━━━━━━━&nbsp;&nbsp;<br/>首部&nbsp;&nbsp;procedure DisposeStr(P: PString); deprecated; $[SysUtils.pas<br/>功能&nbsp;&nbsp;释放字符串指针P资源<br/>说明&nbsp;&nbsp;配合函数NewStr使用<br/>参考&nbsp;&nbsp;procedure System.Dispose<br/>例子&nbsp;&nbsp;&lt;如上参见,如下参见&gt;<br/>━━━━━━━━━━━━━━━━━━━━━&nbsp;&nbsp;<br/>首部&nbsp;&nbsp;procedure AssignStr(var P: PString; const S: string); deprecated; $[SysUtils.pas<br/>功能&nbsp;&nbsp;将字符串S更新给字符串指针P<br/>说明&nbsp;&nbsp;更新值时会释放以前字符串指针的资源<br/>参考&nbsp;&nbsp;function SysUtils.NewStr;function SysUtils.DisposeStr<br/>例子&nbsp;&nbsp;<br/>////////Begin AssignStr<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>var<br/>&nbsp;&nbsp;P: PString;<br/>begin<br/>&nbsp;&nbsp;P := nil;<br/>&nbsp;&nbsp;AssignStr(P, Edit1.Text);<br/>&nbsp;&nbsp;Edit2.Text := P^;<br/>&nbsp;&nbsp;DisposeStr(P);<br/>end;<br/>////////End AssignStr<br/>━━━━━━━━━━━━━━━━━━━━━&nbsp;&nbsp;<br/>首部&nbsp;&nbsp;procedure AppendStr(var Dest: string; const S: string); deprecated; $[SysUtils.pas<br/>功能&nbsp;&nbsp;在字符串Dest后追加字符串S<br/>说明&nbsp;&nbsp;相当于Dest := Dest + S;Delphi6已经不建议使用<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子&nbsp;&nbsp;<br/>////////Begin AppendStr<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>var<br/>&nbsp;&nbsp;S: string;<br/>begin<br/>&nbsp;&nbsp;S := Edit2.Text;<br/>&nbsp;&nbsp;AppendStr(S, Edit1.Text);<br/>&nbsp;&nbsp;Edit2.Text := S;<br/>end;<br/>////////End AppendStr<br/>━━━━━━━━━━━━━━━━━━━━━&nbsp;&nbsp;<br/>首部&nbsp;&nbsp;function UpperCase(const S: string): string; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回字符串S的大写形式<br/>说明&nbsp;&nbsp;非小写字符不处理<br/>参考&nbsp;&nbsp;procedure System.SetLength<br/>例子&nbsp;&nbsp;Edit2.Text := UpperCase(Edit1.Text);<br/>━━━━━━━━━━━━━━━━━━━━━&nbsp;&nbsp;<br/>首部&nbsp;&nbsp;function LowerCase(const S: string): string; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回字符串S的小写形式<br/>说明&nbsp;&nbsp;非大写字符不处理<br/>参考&nbsp;&nbsp;procedure System.SetLength<br/>例子&nbsp;&nbsp;Edit2.Text := LowerCase(Edit1.Text);<br/>━━━━━━━━━━━━━━━━━━━━━&nbsp;&nbsp;<br/>首部&nbsp;&nbsp;function CompareStr(const S1, S2: string): Integer; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回比较两个字符<br/>说明&nbsp;&nbsp;当S1&gt;S2返回值&gt;0;当S1&lt;S2返回值&lt;0;当S1=S2返回值=0;区分大小写<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子&nbsp;&nbsp;SpinEdit1.Value := CompareStr(Edit1.Text, Edit2.Text);<br/>━━━━━━━━━━━━━━━━━━━━━&nbsp;&nbsp;<br/>首部&nbsp;&nbsp;function CompareMem(P1, P2: Pointer; Length: Integer): Boolean; assembler; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回比较两个内存指针<br/>说明&nbsp;&nbsp;CompareMem(PChar(&#39;12a&#39;), PChar(&#39;12c&#39;), 2)=True;CompareMem(PChar(&#39;12a&#39;), PChar(&#39;12c&#39;), 3)=False<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子&nbsp;&nbsp;CheckBox1.Checked := CompareMem(Self, Form1, 8);<br/>━━━━━━━━━━━━━━━━━━━━━&nbsp;&nbsp;<br/>首部&nbsp;&nbsp;function CompareText(const S1, S2: string): Integer; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回比较两个字符串<br/>说明&nbsp;&nbsp;不区分大小写<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子&nbsp;&nbsp;SpinEdit1.Value := CompareText(Edit1.Text, Edit2.Text);<br/>━━━━━━━━━━━━━━━━━━━━━&nbsp;&nbsp;<br/>首部&nbsp;&nbsp;function SameText(const S1, S2: string): Boolean; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回两个字符串是否相等<br/>说明&nbsp;&nbsp;不区分大小写<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子&nbsp;&nbsp;CheckBox1.Checked := SameText(Edit1.Text, Edit2.Text);<br/>━━━━━━━━━━━━━━━━━━━━━&nbsp;&nbsp;<br/>首部&nbsp;&nbsp;function AnsiUpperCase(const S: string): string; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回字符串S的大写形式<br/>说明&nbsp;&nbsp;ANSI(American National Standards Institute)美国国家标准协会;非小写的字符不变<br/>参考&nbsp;&nbsp;function Windows.CharUpperBuff<br/>例子&nbsp;&nbsp;Edit2.Text := AnsiUpperCase(Edit1.Text);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function AnsiLowerCase(const S: string): string; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回字符串S的小写形式<br/>说明&nbsp;&nbsp;非大写字符不处理<br/>参考&nbsp;&nbsp;function Windows.CharLowerBuff<br/>例子&nbsp;&nbsp;Edit2.Text := AnsiLowerCase(Edit1.Text);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function AnsiCompareStr(const S1, S2: string): Integer; $[SysUtils.pas<br/>功能&nbsp;&nbsp;反回比较两个字符串<br/>说明&nbsp;&nbsp;当S1&gt;S2返回值&gt;0;当S1&lt;S2返回值&lt;0;当S1=S2返回值=0;区分大小写<br/>参考&nbsp;&nbsp;function Windows.CompareString<br/>例子&nbsp;&nbsp;SpinEdit1.Value := AnsiCompareStr(Edit1.Text, Edit2.Text);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function AnsiSameStr(const S1, S2: string): Boolean; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回两个字符串是否相等<br/>说明&nbsp;&nbsp;区分大小写<br/>参考&nbsp;&nbsp;function SysUtils.AnsiCompareStr<br/>例子&nbsp;&nbsp;CheckBox1.Checked := AnsiSameStr(Edit1.Text, Edit2.Text);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function AnsiCompareText(const S1, S2: string): Integer; $[SysUtils.pas<br/>功能&nbsp;&nbsp;反回比较两个字符串<br/>说明&nbsp;&nbsp;当S1&gt;S2返回值&gt;0;当S1&lt;S2返回值&lt;0;当S1=S2返回值=0;不区分大小写<br/>参考&nbsp;&nbsp;function Windows.CompareString<br/>例子&nbsp;&nbsp;SpinEdit1.Value := AnsiCompareText(Edit1.Text, Edit2.Text);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function AnsiSameText(const S1, S2: string): Boolean; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回两个字符串是否相等<br/>说明&nbsp;&nbsp;不区分大小写<br/>参考&nbsp;&nbsp;function SysUtils.AnsiCompareText<br/>例子&nbsp;&nbsp;CheckBox1.Checked := AnsiSameText(Edit1.Text, Edit2.Text);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function AnsiStrComp(S1, S2: PChar): Integer; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回比较两个指针字符串<br/>说明&nbsp;&nbsp;当S1&gt;S2返回值&gt;0;当S1&lt;S2返回值&lt;0;当S1=S2返回值=0;区分大小写<br/>参考&nbsp;&nbsp;function System.CompareString<br/>例子&nbsp;&nbsp;SpinEdit1.Value := AnsiStrComp(PChar(Edit1.Text), PChar(Edit2.Text))<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function AnsiStrIComp(S1, S2: PChar): Integer; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回比较两个指针字符串<br/>说明&nbsp;&nbsp;当S1&gt;S2返回值&gt;0;当S1&lt;S2返回值&lt;0;当S1=S2返回值=0;不区分大小写;Ignore(忽略)<br/>参考&nbsp;&nbsp;function Windows.CompareString<br/>例子&nbsp;&nbsp;SpinEdit1.Value := AnsiStrIComp(PChar(Edit1.Text), PChar(Edit2.Text))<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function AnsiStrLComp(S1, S2: PChar; MaxLen: Cardinal): Integer; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回比较两个指针字符串指定长度<br/>说明&nbsp;&nbsp;当S1&gt;S2返回值&gt;0;当S1&lt;S2返回值&lt;0;当S1=S2返回值=0;区分大小写;Length(长度)<br/>参考&nbsp;&nbsp;function Windows.CompareString<br/>例子&nbsp;&nbsp;SpinEdit1.Value := AnsiStrLComp(PChar(Edit1.Text), PChar(Edit2.Text), SpinEdit2.Value)<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function AnsiStrLIComp(S1, S2: PChar; MaxLen: Cardinal): Integer; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回比较两个指针字符串指定长度<br/>说明&nbsp;&nbsp;当S1&gt;S2返回值&gt;0;当S1&lt;S2返回值&lt;0;当S1=S2返回值=0;不区分大小写<br/>参考&nbsp;&nbsp;function Windows.CompareString<br/>例子&nbsp;&nbsp;SpinEdit1.Value := AnsiStrLIComp(PChar(Edit1.Text), PChar(Edit2.Text), SpinEdit2.Value)<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function AnsiStrLower(Str: PChar): PChar; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回指针字符串小写形式<br/>说明&nbsp;&nbsp;非大写字符不处理<br/>参考&nbsp;&nbsp;function Windows.CharLower<br/>例子&nbsp;&nbsp;Edit2.Text := AnsiStrLower(PChar(Edit1.Text));<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function AnsiStrUpper(Str: PChar): PChar; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回指针字符串大写形式<br/>说明&nbsp;&nbsp;非小写字符不处理<br/>参考&nbsp;&nbsp;function Windows.CharUpper<br/>例子&nbsp;&nbsp;Edit2.Text := AnsiStrUpper(PChar(Edit1.Text));<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function AnsiLastChar(const S: string): PChar; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回字符串S的最后一个指针字符<br/>说明&nbsp;&nbsp;当字符串S为空串则返回空指针<br/>参考&nbsp;&nbsp;function SysUtils.ByteType<br/>例子&nbsp;&nbsp;Edit2.Text := AnsiLastChar(Edit1.Text);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function AnsiStrLastChar(P: PChar): PChar; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回指针字符串P的最后一个指针字符<br/>说明&nbsp;&nbsp;当字符串P为空空指针则返回空指针<br/>参考&nbsp;&nbsp;function SysUtils.ByteType<br/>例子&nbsp;&nbsp;Edit2.Text := AnsiLastChar(PChar(Edit1.Text));<br/>━━━━━━━━━━━━━━━━━━━━━&nbsp;&nbsp;<br/>首部&nbsp;&nbsp;function WideUpperCase(const S: WideString): WideString; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回双字节字符串的大写形式<br/>说明&nbsp;&nbsp;WideChar双字节字符<br/>参考&nbsp;&nbsp;function Windows.CharUpperBuffW<br/>例子&nbsp;&nbsp;Edit2.Text := WideUpperCase(Edit1.Text);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function WideLowerCase(const S: WideString): WideString; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回双字节字符串的小写形式<br/>说明&nbsp;&nbsp;我怎么就测试不出来呢<br/>参考&nbsp;&nbsp;function Windows.CharLowerBuffW<br/>例子&nbsp;&nbsp;Edit2.Text := WideLowerCase(Edit1.Text);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function WideCompareStr(const S1, S2: WideString): Integer; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回比较两个双字节字符串<br/>说明&nbsp;&nbsp;当S1&gt;S2返回值&gt;0;当S1&lt;S2返回值&lt;0;当S1=S2返回值=0;区分大小写<br/>参考&nbsp;&nbsp;function Windows.CompareStringW<br/>例子&nbsp;&nbsp;SpinEdit1.Value := WideCompareStr(Edit1.Text, Edit2.Text);<br/>━━━━━━━━━━━━━━━━━━━━━&nbsp;&nbsp;<br/>首部&nbsp;&nbsp;function WideSameStr(const S1, S2: WideString): Boolean; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回两个双字节字符串是否相同<br/>说明&nbsp;&nbsp;区分大小写<br/>参考&nbsp;&nbsp;function SysUtils.WideCompareStr<br/>例子&nbsp;&nbsp;CheckBox1.Checked := WideSameStr(Edit1.Text, Edit2.Text);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function WideCompareText(const S1, S2: WideString): Integer; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回比较两个双字节字符串<br/>说明&nbsp;&nbsp;当S1&gt;S2返回值&gt;0;当S1&lt;S2返回值&lt;0;当S1=S2返回值=0;不区分大小写<br/>参考&nbsp;&nbsp;function Windows.CompareStringW<br/>例子&nbsp;&nbsp;SpinEdit1.Value := WideCompareText(Edit1.Text, Edit2.Text);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function WideSameText(const S1, S2: WideString): Boolean; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回两个双字节字符串是否相同<br/>说明&nbsp;&nbsp;不区分大小写<br/>参考&nbsp;&nbsp;function SysUtils.WideCompareText<br/>例子&nbsp;&nbsp;CheckBox1.Checked := WideSameText(Edit1.Text, Edit2.Text);<br/>━━━━━━━━━━━━━━━━━━━━━&nbsp;&nbsp;<br/>首部&nbsp;&nbsp;function Trim(const S: string): string; overload; $[SysUtils.pas<br/>首部&nbsp;&nbsp;function Trim(const S: WideString): WideString; overload; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回除去字符串S左右不可见字符<br/>说明&nbsp;&nbsp;小于#32的字符看作不可见字符<br/>参考&nbsp;&nbsp;function System.Copy<br/>例子&nbsp;&nbsp;Edit2.Text := Trim(Edit1.Text);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function TrimLeft(const S: string): string; overload; $[SysUtils.pas<br/>首部&nbsp;&nbsp;function TrimLeft(const S: WideString): WideString; overload; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回除去字符串S左边不可见字符<br/>说明&nbsp;&nbsp;小于#32的字符看作不可见字符<br/>参考&nbsp;&nbsp;function System.Copy<br/>例子&nbsp;&nbsp;Edit2.Text := TrimLeft(Edit1.Text);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function TrimRight(const S: string): string; overload; $[SysUtils.pas<br/>首部&nbsp;&nbsp;function TrimRight(const S: WideString): WideString; overload; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回除去字符串S右边不可见字符<br/>说明&nbsp;&nbsp;小于#32的字符看作不可见字符<br/>参考&nbsp;&nbsp;function System.Copy<br/>例子&nbsp;&nbsp;Edit2.Text := TrimRight(Edit1.Text);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function QuotedStr(const S: string): string; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回字符串S在pascal中的表现形式<br/>说明&nbsp;&nbsp;单引号中的一个单引号将转成两个<br/>参考&nbsp;&nbsp;procedure System.Ins&#101;rt<br/>例子&nbsp;&nbsp;Edit2.Text := QuotedStr(Edit1.Text);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function AnsiQuotedStr(const S: string; Quote: Char): string; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回字符串S以字符Quote为引号的表现形式<br/>说明&nbsp;&nbsp;AnsiQuotedStr(&#39;hello&#34;world&#39;, &#39;@&#39;)=&#39;@hello&#34;world@&#39;;AnsiQuotedStr(&#39;hello&#34;world&#39;, &#39;&#34;&#39;)=&#39;&#34;hello&#34;&#34;world&#34;&#39;<br/>参考&nbsp;&nbsp;function SysUtils.AnsiStrScan<br/>例子&nbsp;&nbsp;Edit2.Text := AnsiQuotedStr(Edit1.Text, &#39;&#34;&#39;);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function AnsiExtractQuotedStr(var Src: PChar; Quote: Char): string; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回以字符Quote为引号的表现形式原形<br/>说明&nbsp;&nbsp;表现形式非法时Src不变否则为空<br/>参考&nbsp;&nbsp;function SysUtils.AnsiStrScan<br/>例子<br/>///////Begin AnsiExtractQuotedStr<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>var<br/>&nbsp;&nbsp;P: PChar;<br/>begin<br/>&nbsp;&nbsp;P := PChar(Edit1.Text);<br/>&nbsp;&nbsp;Edit2.Text := AnsiExtractQuotedStr(P, &#39;&#34;&#39;);<br/>&nbsp;&nbsp;Edit3.Text := P;<br/>end;<br/>///////End AnsiExtractQuotedStr<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function AnsiDequotedStr(const S: string; AQuote: Char): string; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回以字符AQuote为引号的表现形式原形<br/>说明&nbsp;&nbsp;表现形式非法时则返回S<br/>参考&nbsp;&nbsp;function SysUtils.AnsiExtractQuotedStr<br/>例子&nbsp;&nbsp;Edit2.Text := AnsiDequotedStr(Edit1.Text, &#39;&#34;&#39;);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function AdjustLineBreaks(const S: string; Style: TTextLineBreakStyle = {$IFDEF LINUX} tlbsLF {$ENDIF} {$IFDEF MSWINDOWS} tlbsCRLF {$ENDIF}): string; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回将给定字符串的行分隔符调整为CR/LF序列<br/>说明&nbsp;&nbsp;AdjustLineBreaks(&#39;1&#39;#13&#39;2&#39;#13)=&#39;1&#39;#13#10&#39;2&#39;#13#10;AdjustLineBreaks(&#39;1&#39;#10&#39;2&#39;#10)=&#39;1&#39;#13#10&#39;2&#39;#13#10<br/>参考&nbsp;&nbsp;function SysUtils.StrNextChar<br/>例子&nbsp;&nbsp;&lt;NULL&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function IsValidIdent(const Ident: string): Boolean; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回字符串Ident是否是正确的标识符<br/>说明&nbsp;&nbsp;标识符::字母|下划线[字母|下划线|数字]...<br/>参考&nbsp;&nbsp;&lt;NULL&gt;<br/>例子&nbsp;&nbsp;CheckBox1.Checked := IsValidIdent(Edit1.Text);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function IntToStr(Value: Integer): string; overload; $[SysUtils.pas<br/>首部&nbsp;&nbsp;function IntToStr(Value: Int64): string; overload; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回整数Value转换成字符串<br/>说明&nbsp;&nbsp;Format(&#39;%d&#39;, [Value])<br/>参考&nbsp;&nbsp;function SysUtils.FmtStr<br/>例子&nbsp;&nbsp;Edit2.Text := IntToStr(SpinEdit1.Value);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function IntToHex(Value: Integer; Digits: Integer): string; overload; $[SysUtils.pas<br/>首部&nbsp;&nbsp;function IntToHex(Value: Int64; Digits: Integer): string; overload; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回整数Value转换成十六进制表现结果;Format(&#39;%.*x&#39;, [Digits, Value])<br/>说明&nbsp;&nbsp;参数Digits指定字符最小宽度;最小宽度不足时将用0填充<br/>参考&nbsp;&nbsp;function SysUtils.FmtStr<br/>例子&nbsp;&nbsp;Edit2.Text := IntToHex(SpinEdit1.Value, SpinEdit2.Value);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function StrToInt(const S: string): Integer; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回字符串S转换成整数<br/>说明&nbsp;&nbsp;字符串非整数表达时将引起异常<br/>参考&nbsp;&nbsp;procedure System.Val<br/>例子&nbsp;&nbsp;SpinEdit1.Value := StrToInt(Edit1.Text);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function StrToIntDef(const S: string; Default: Integer): Integer; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回字符串S转换成整数<br/>说明&nbsp;&nbsp;字符串非整数表达时则返回默认值Default<br/>参考&nbsp;&nbsp;procedure System.Val<br/>例子&nbsp;&nbsp;SpinEdit1.Value := StrToIntDef(Edit1.Text, 0);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function TryStrToInt(const S: string; out Value: Integer): Boolean; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回字符串S转换成整数Value是否成功<br/>说明&nbsp;&nbsp;字符串非整数表达时返回False并且Value将输出为0<br/>参考&nbsp;&nbsp;procedure System.Val<br/>例子<br/>///////Begin TryStrToInt<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>var<br/>&nbsp;&nbsp;I: Integer;<br/>begin<br/>&nbsp;&nbsp;CheckBox1.Checked := TryStrToInt(Edit1.Text, I);<br/>&nbsp;&nbsp;SpinEdit1.Value := I;<br/>end;<br/>///////End TryStrToInt<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function StrToInt64(const S: string): Int64; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回字符串S转换成六十四位整数<br/>说明&nbsp;&nbsp;字符串非六十四位整数表达时将引起异常<br/>参考&nbsp;&nbsp;procedure System.Val<br/>例子&nbsp;&nbsp;SpinEdit1.Value := StrToInt64(Edit1.Text);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function StrToInt64Def(const S: string; const Default: Int64): Int64; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回字符串S转换成六十四位整数<br/>说明&nbsp;&nbsp;字符串非六十四位整数表达时则返回默认值Default<br/>参考&nbsp;&nbsp;procedure System.Val<br/>例子&nbsp;&nbsp;SpinEdit1.Value := StrToInt64Def(Edit1.Text, 0);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function TryStrToInt64(const S: string; out Value: Int64): Boolean; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回字符串S转换成六十四位整数Value是否成功<br/>说明&nbsp;&nbsp;字符串非六十四位整数表达时返回False并且Value将输出为0<br/>参考&nbsp;&nbsp;procedure System.Val<br/>例子<br/>///////Begin TryStrToInt64<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>var<br/>&nbsp;&nbsp;I: Int64;<br/>begin<br/>&nbsp;&nbsp;CheckBox1.Checked := TryStrToInt64(Edit1.Text, I);<br/>&nbsp;&nbsp;SpinEdit1.Value := I;<br/>end;<br/>///////End TryStrToInt64<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function StrToBool(const S: string): Boolean; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回字符串S转换成逻辑值<br/>说明&nbsp;&nbsp;字符非逻辑表达时将引起异常<br/>参考&nbsp;&nbsp;function SysUtils.TryStrToBool<br/>例子&nbsp;&nbsp;CheckBox1.Checked := StrToBool(Edit1.Text);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function StrToBoolDef(const S: string; const Default: Boolean): Boolean; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回字符串S转换成逻辑值<br/>说明&nbsp;&nbsp;字符非逻辑表达时则返回默认值Default<br/>参考&nbsp;&nbsp;function SysUtils.TryStrToBool<br/>例子&nbsp;&nbsp;CheckBox1.Checked := StrToBoolDef(Edit1.Text, False);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function TryStrToBool(const S: string; out Value: Boolean): Boolean; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回字符串S转换成逻辑值Value是否成功<br/>说明&nbsp;&nbsp;[注意]0为假非0为真;不是&#39;True&#39;和&#39;False&#39;;Delphi6 Bug 如下修正<br/>参考&nbsp;&nbsp;function SysUtils.AnsiSameText;var SysUtils.TrueBoolStrs;var SysUtils.FalseBoolStrs<br/>例子<br/>///////Begin TryStrToBool<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>var<br/>&nbsp;&nbsp;B: Boolean;<br/>begin<br/>&nbsp;&nbsp;SetLength(TrueBoolStrs, 2);<br/>&nbsp;&nbsp;SetLength(FalseBoolStrs, 2);<br/>&nbsp;&nbsp;TrueBoolStrs[0] := &#39;True&#39;;<br/>&nbsp;&nbsp;FalseBoolStrs[0] := &#39;False&#39;;<br/>&nbsp;&nbsp;TrueBoolStrs[1] := &#39;Yes&#39;;<br/>&nbsp;&nbsp;FalseBoolStrs[1] := &#39;No&#39;;<br/>&nbsp;&nbsp;CheckBox1.Checked := TryStrToBool(Edit1.Text, B);<br/>&nbsp;&nbsp;CheckBox2.Checked := B;<br/>end;<br/>///////End TryStrToBool<br/>附加<br/>///////Begin TryStrToBool<br/>function TryStrToBool(const S: string; out Value: Boolean): Boolean;<br/>&nbsp;&nbsp;function CompareWith(const aArray: array of string): Boolean;<br/>&nbsp;&nbsp;var<br/>&nbsp;&nbsp;&nbsp;&nbsp;I: Integer;<br/>&nbsp;&nbsp;begin<br/>&nbsp;&nbsp;&nbsp;&nbsp;Result := False;<br/>&nbsp;&nbsp;&nbsp;&nbsp;for I := Low(aArray) to High(aArray) do<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if AnsiSameText(S, aArray[I]) then<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;begin<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Result := True;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Break;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end;<br/>&nbsp;&nbsp;end;<br/>var<br/>&nbsp;&nbsp;LResult: Extended;<br/>begin<br/>&nbsp;&nbsp;Result := TryStrToFloat(S, LResult);<br/>&nbsp;&nbsp;if Result then<br/>&nbsp;&nbsp;&nbsp;&nbsp;Value := LResult &lt;&gt; 0<br/>&nbsp;&nbsp;else<br/>&nbsp;&nbsp;begin<br/>&nbsp;&nbsp;&nbsp;&nbsp;Result := True; //修正处<br/>&nbsp;&nbsp;&nbsp;&nbsp;VerifyBoolStrArray;<br/>&nbsp;&nbsp;&nbsp;&nbsp;if CompareWith(TrueBoolStrs) then<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Value := True<br/>&nbsp;&nbsp;&nbsp;&nbsp;else if CompareWith(FalseBoolStrs) then<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Value := False<br/>&nbsp;&nbsp;&nbsp;&nbsp;else<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Result := False;<br/>&nbsp;&nbsp;end;<br/>end;<br/>///////End TryStrToBool<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function BoolToStr(B: Boolean; UseBoolStrs: Boolean = False): string; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回逻辑值B转换成字符串<br/>说明&nbsp;&nbsp;BoolToStr(False, False)=&#39;0&#39;;BoolToStr(False, True)=&#39;-1&#39;<br/>参考&nbsp;&nbsp;var SysUtils.TrueBoolStrs;var SysUtils.FalseBoolStrs<br/>例子&nbsp;&nbsp;Edit1.Text := BoolToStr(CheckBox1.Checked, CheckBox2.Checked);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function LoadStr(Ident: Integer): string; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回根据标识Ident的字符串资源<br/>说明&nbsp;&nbsp;字符串资源是指程序的内部资源<br/>参考&nbsp;&nbsp;function SysUtils.FindStringResource<br/>例子&nbsp;&nbsp;Edit2.Text := LoadStr(StrToIntDef(Edit1.Text, 0));<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function FmtLoadStr(Ident: Integer; const Args: array of const): string; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回格式化的字符串资源<br/>说明&nbsp;&nbsp;字符串资源是指程序的内部资源<br/>参考&nbsp;&nbsp;function SysUtils.FmtStr;function SysUtils.FindStringResource<br/>例子&nbsp;&nbsp;&lt;NULL&gt;;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function FileOpen(const FileName: string; Mode: LongWord): Integer; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回打开文件果<br/>说明&nbsp;&nbsp;Mode指定打开文件的模式(fmOpenRead,fmOpenWrite,fmOpenReadWrite....);打开失败则返回负数<br/>参考&nbsp;&nbsp;function Windows.Cr&#101;ateFile<br/>例子<br/>///////Begin FileOpen,FileClose<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>var<br/>&nbsp;&nbsp;I: Integer;<br/>begin<br/>&nbsp;&nbsp;I := FileOpen(Edit1.Text, fmOpenRead);<br/>&nbsp;&nbsp;CheckBox1.Checked := I &gt; 0;<br/>&nbsp;&nbsp;FileClose(I);<br/>end;<br/>///////Begin FileOpen,FileClose<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function FileCr&#101;ate(const FileName: string): Integer; overload; $[SysUtils.pas<br/>首部&nbsp;&nbsp;function FileCr&#101;ate(const FileName: string; Rights: Integer): Integer; overload; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回创建文件<br/>说明&nbsp;&nbsp;创建失败则返回负数<br/>参考&nbsp;&nbsp;function Windows.Cr&#101;ateFile<br/>例子<br/>///////Begin FileCr&#101;ate<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>var<br/>&nbsp;&nbsp;I: Integer;<br/>begin<br/>&nbsp;&nbsp;I := FileCr&#101;ate(Edit1.Text);<br/>&nbsp;&nbsp;CheckBox1.Checked := I &gt; 0;<br/>&nbsp;&nbsp;FileClose(I);<br/>end;<br/>///////End FileCr&#101;ate<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function FileRead(Handle: Integer; var Buffer; Count: LongWord): Integer; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回读取文件缓冲区的大小<br/>说明&nbsp;&nbsp;读取失败则返回负数<br/>参考&nbsp;&nbsp;function Windows.ReadFile<br/>例子&nbsp;&nbsp;&lt;参见FileOpen&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function FileWrite(Handle: Integer; const Buffer; Count: LongWord): Integer; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回写入文件缓冲区的大小<br/>说明&nbsp;&nbsp;写入失败则返回负数<br/>参考&nbsp;&nbsp;function Windows.WriteFile<br/>例子&nbsp;&nbsp;&lt;参见FileCr&#101;ate&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function FileSeek(Handle, Offset, o&#114;igin: Integer): Integer; overload; $[SysUtils.pas<br/>首部&nbsp;&nbsp;function FileSeek(Handle: Integer; const Offset: Int64; o&#114;igin: Integer): Int64; overload; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回指定文件偏移量<br/>说明&nbsp;&nbsp;Offset指定偏移量;Origin指定原点(Origin为0时指文件首;为1时指当前位置;为2时指文件尾)<br/>参考&nbsp;&nbsp;function Windows.SetFilePointer<br/>例子&nbsp;&nbsp;&lt;参见FileOpen&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;procedure FileClose(Handle: Integer); $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回关闭文件<br/>说明&nbsp;&nbsp;不关闭打开的文件会占用系统资源<br/>参考&nbsp;&nbsp;function Windows.CloseHandle<br/>例子&nbsp;&nbsp;&lt;参见FileOpen&gt;<br/>━━━━━━━━━━━━━━━━━━━━━&nbsp;&nbsp;<br/>首部&nbsp;&nbsp;function FileAge(const FileName: string): Integer; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回文件创建的时间<br/>说明&nbsp;&nbsp;文件不存在则返回-1<br/>参考&nbsp;&nbsp;function Windows.FindFirstFile<br/>例子<br/>///////Begin FileAge,DateTimeToStr,FileDateToDateTime<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>begin<br/>&nbsp;&nbsp;SpinEdit1.Value := FileAge(Edit1.Text);<br/>&nbsp;&nbsp;if SpinEdit1.Value &gt; 0 then<br/>&nbsp;&nbsp;&nbsp;&nbsp;Edit2.Text := DateTimeToStr(FileDateToDateTime(SpinEdit1.Value));<br/>end;<br/>///////End FileAge,DateTimeToStr,FileDateToDateTime<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function FileExists(const FileName: string): Boolean; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回文件名FileName是否有实体存在<br/>说明&nbsp;&nbsp;包括隐藏文件<br/>参考&nbsp;&nbsp;function SysUtils.FileAge<br/>例子&nbsp;&nbsp;CheckBox1.Checked := FileExists(Edit1.Text);<br/>━━━━━━━━━━━━━━━━━━━━━&nbsp;&nbsp;<br/>首部&nbsp;&nbsp;function DirectoryExists(const Directory: string): Boolean; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回目录名FileName是否有实体存在<br/>说明&nbsp;&nbsp;包括隐藏目录<br/>参考&nbsp;&nbsp;function Windows.GetFileAttributes<br/>例子&nbsp;&nbsp;CheckBox1.Checked := DirectoryExists(Edit1.Text);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function ForceDirectories(Dir: string): Boolean; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回创建子目录是否成功<br/>说明&nbsp;&nbsp;直接创建多级目录<br/>参考&nbsp;&nbsp;function SysUtils.Cr&#101;ateDir<br/>例子&nbsp;&nbsp;CheckBox1.Checked := ForceDirectories(Edit1.Text);<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function FindFirst(const Path: string; Attr: Integer; var F: TSearchRec): Integer; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回设置文件搜索<br/>说明&nbsp;&nbsp;搜索成功则返回0<br/>参考&nbsp;&nbsp;function Windows.FindFirstFile<br/>例子<br/>///////Begin FindFirst,FindNext,FindClose<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>var<br/>&nbsp;&nbsp;vSearchRec: TSearchRec;<br/>&nbsp;&nbsp;I: Integer;<br/>begin<br/>&nbsp;&nbsp;Memo1.Clear;<br/>&nbsp;&nbsp;I := FindFirst(Edit1.Text, faAnyFile, vSearchRec);<br/>&nbsp;&nbsp;while I = 0 do begin<br/>&nbsp;&nbsp;&nbsp;&nbsp;Memo1.Lines.Add(vSearchRec.Name);<br/>&nbsp;&nbsp;&nbsp;&nbsp;I := FindNext(vSearchRec);<br/>&nbsp;&nbsp;end;<br/>&nbsp;&nbsp;FindClose(vSearchRec);<br/>end;<br/>///////End FindFirst,FindNext,FindClose<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;function FindNext(var F: TSearchRec): Integer; $[SysUtils.pas<br/>功能&nbsp;&nbsp;返回继续文件搜索<br/>说明&nbsp;&nbsp;搜索成功则返回0<br/>参考&nbsp;&nbsp;function Windows.FindNextFile<br/>例子&nbsp;&nbsp;&lt;参见FindFirst&gt;<br/>━━━━━━━━━━━━━━━━━━━━━<br/>首部&nbsp;&nbsp;procedure FindClose(var F: TSearchRec); $[SysUtils.pas<br/>功能&nbsp;&nbsp;结束当前文件搜索<br/>说明&nbsp;&nbsp;不关闭查询会占用系统资源<br/>参考&nbsp;&nbsp;function Windows.FindClose<br/>例子&nbsp;&nbsp;&lt;参见FindFirst&gt;<br/>━━━━━━━━━━━━━━━━━━━━━]]></description>
		</item>
		
			<item>
			<link>http://www.zjidea.com/blog/article/delphi/20091208delphi.htm</link>
			<title><![CDATA[Delphi字符串、PChar与字符数组之间的转换]]></title>
			<author>lzq0323@yahoo.com.cn(相逢萍水)</author>
			<category><![CDATA[Delphi编程]]></category>
			<pubDate>Tue,08 Dec 2009 15:54:02 +0800</pubDate>
			<guid>http://www.zjidea.com/blog/default.asp?id=455</guid>
		<description><![CDATA[Delphi中,字符串、PChar与字符数组之间的转换<br/><br/>设有以下三个变量：<br/>var<br/>s:string;<br/>p:pchar;<br/>a:array[1..20] of char;<br/>那么三者之间的转换如下：<br/>1、字符串到PChar<br/>&nbsp;&nbsp;&nbsp;&nbsp;p:=PChar(s);<br/>2、PChar到字符串<br/>&nbsp;&nbsp;&nbsp;&nbsp;s:=p;<br/>3、PChar到字符数组<br/>&nbsp;&nbsp;&nbsp;&nbsp;StrCopy(@a,p);<br/>4、字符数组到PChar<br/>&nbsp;&nbsp;&nbsp;&nbsp;PChar(@a);<br/>5、字符串与字符数组之间的转换就只有通过PChar来中转了。例如下面这个例子：<br/>procedure TForm1.btn1Click(Sender: TObject);<br/>var<br/>str:array[1..10] of char;<br/>begin<br/>StrCopy(@str,PChar(mmo1.Text));<br/>mmo2.Text:=PChar(@str);<br/>end;]]></description>
		</item>
		
			<item>
			<link>http://www.zjidea.com/blog/article/delphi/20091205program.htm</link>
			<title><![CDATA[Delphi中Messagedlg的用法与汉化]]></title>
			<author>lzq0323@yahoo.com.cn(相逢萍水)</author>
			<category><![CDATA[Delphi编程]]></category>
			<pubDate>Sat,05 Dec 2009 10:57:07 +0800</pubDate>
			<guid>http://www.zjidea.com/blog/default.asp?id=453</guid>
		<description><![CDATA[<span style="font-size:11pt;line-height:100%;"><span style="color:Red">MessageDlg用法</span></span><br/><br/>messageDlg, 是在对话框显示消息，并等待用户点击一个按钮，然后返回一个整数确定知道是那个按钮.<br/>原型:MessageDlg(const Msg: string; DlgType: TMsgDlgType;Buttons: TMsgDlgButtons; HelpCtx: Longint): Integer<br/><br/>Msg:想要提示的文字<br/>DlgType:对话框的类型<br/>Buttons:对话框中的按钮<br/>HelpCtx:定义对话框的帮助屏幕，使用HelpCtx参数可以指定当用户单击Help按钮或按F1键所弹出的帮助主题的帮助上下文ID，一般也用不上，用0，表示帮助主题为空。<br/><br/><span style="color:Maroon">对话框类型：</span><br/>mtwarning——含有感叹号的警告对话框<br/>mterror——含有红色叉符号的错误对话框<br/>mtinformation——含有蓝色i符号的信息对话框<br/>mtconfirmation——含有绿色问号的确认对话框<br/>mtcustom——不含图标的一般对话框，对话框的标题是程序的名称<br/><br/><span style="color:Maroon">按钮组中的按钮：</span><br/>mbYes——mrYes或6<br/>mbNo——mrNo或7<br/>mbOk——mrOk或1<br/>mbCancel——mrCancel或2<br/>mbHelp——help按钮<br/>mbAbort——mrAbort或3<br/>mbRetry——mrRetry或4<br/>mbIgnore——mrIgnore或5<br/>mbAll——mrAll或8<br/>mbNoToAll——9<br/>mbYesToAll——10<br/><br/>举例:<br/>procedure TForm1.Button1Click(Sender: TObject);<br/>begin<br/>&nbsp;&nbsp;Messagedlg(&#39;你确定吗&#39;,mtWarning,[mbYES,mbNO],0);<br/>&nbsp;&nbsp;MessageDlg(&#39;错误(1001)&#39;,mtError,[mbCancel],0);<br/>end;<br/><br/><br/><span style="color:Red">MessageDlg()信息的汉化</span> <br/><br/>Delphi中的常量都放在consts.pas中,修改它可以达到汉化的目的.如: <br/>MessageDlg()显示的窗口标题及其中的 <br/>按钮标题都是英文,虽然不影响使用,但在一个中文软件中总显得有些不协调. <br/>为此在consts.pas中查找以下内容: <br/>&#34;SMsgDlgWarning&#34; <br/>把 <br/>SMsgDlgWarning = &#39;Warning&#39;; <br/>SMsgDlgError = &#39;Error&#39;; <br/>SMsgDlgInformation = &#39;Information&#39;; <br/>SMsgDlgConfirm = &#39;Confirm&#39;; <br/>SMsgDlgYes = &#39;&amp;Yes&#39;; <br/>SMsgDlgNo = &#39;&amp;No&#39;; <br/>SMsgDlgOK = &#39;OK&#39;; <br/>SMsgDlgCancel = &#39;Cancel&#39;; <br/>SMsgDlgHelp = &#39;&amp;Help&#39;; <br/>SMsgDlgHelpNone = &#39;No help available&#39;; <br/>SMsgDlgHelpHelp = &#39;Help&#39;; <br/>SMsgDlgAbort = &#39;&amp;Abort&#39;; <br/>SMsgDlgRetry = &#39;&amp;Retry&#39;; <br/>SMsgDlgIgnore = &#39;&amp;Ignore&#39;; <br/>SMsgDlgAll = &#39;&amp;All&#39;; <br/>SMsgDlgNoToAll = &#39;N&amp;o to All&#39;; <br/>SMsgDlgYesToAll = &#39;Yes to &amp;All&#39;; <br/>改成 <br/>SMsgDlgWarning = &#39;警告&#39;; <br/>SMsgDlgError = &#39;错误&#39;; <br/>SMsgDlgInformation = &#39;提示&#39;; <br/>SMsgDlgConfirm = &#39;确认&#39;; <br/>SMsgDlgYes = &#39;是(&amp;Y)&#39;; <br/>SMsgDlgNo = &#39;不(&amp;N)&#39;; <br/>SMsgDlgOK = &#39;确定&#39;; <br/>SMsgDlgCancel = &#39;取消&#39;; <br/>SMsgDlgHelp = &#39;帮助(&amp;H)&#39;; <br/>SMsgDlgHelpNone = &#39;没有该帮助信息&#39;; <br/>SMsgDlgHelpHelp = &#39;帮助&#39;; <br/>SMsgDlgAbort = &#39;放弃(&amp;A)&#39;; <br/>SMsgDlgRetry = &#39;重试(&amp;R)&#39;; <br/>SMsgDlgIgnore = &#39;忽略(&amp;I)&#39;; <br/>SMsgDlgAll = &#39;全部(&amp;A)&#39;; <br/>SMsgDlgNoToAll = &#39;全都不(&amp;O)&#39;; <br/>SMsgDlgYesToAll = &#39;全都是(&amp;A)&#39;; <br/>然后重新编译Consts.pas,把Consts.duc <br/>拷到delphi的lib和slib子目录下,就一劳永逸啦!<br/>]]></description>
		</item>
		
			<item>
			<link>http://www.zjidea.com/blog/article/delphi/20091204program.htm</link>
			<title><![CDATA[解决delphi 中Label 中文显示不全的问题]]></title>
			<author>lzq0323@yahoo.com.cn(相逢萍水)</author>
			<category><![CDATA[Delphi编程]]></category>
			<pubDate>Fri,04 Dec 2009 14:28:48 +0800</pubDate>
			<guid>http://www.zjidea.com/blog/default.asp?id=452</guid>
		<description><![CDATA[这几天在学Delphi,碰到一些小问题,delphi 中Label 中文显示不全是其中一个,现在让我们来看看如何解决这些问题!<br/><br/>方法有两种<br/><br/>第一种:把Label的AutoSize设置为False，然后把Label调整成能显示出内容的大小就OK了<br/><br/>第二种:把Form的Font属性进行如下设置：字体为宋体，字号为小五，字形为常规，字符集为“CHINESE_GB2312”，把Label的ParentFont设置为True即可！<br/>Font属性设置如下图所示:<br/><br/><img src="http://www.zjidea.com/blog/attachments/month_0912/q2009124142826.jpg" border="0" alt=""/><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.zjidea.com/blog/article/delphi/20091207delphi.htm</link>
			<title><![CDATA[关于Delphi 7.0常用函数手册]]></title>
			<author>lzq0323@yahoo.com.cn(相逢萍水)</author>
			<category><![CDATA[Delphi编程]]></category>
			<pubDate>Tue,01 Dec 2009 11:06:14 +0800</pubDate>
			<guid>http://www.zjidea.com/blog/default.asp?id=454</guid>
		<description><![CDATA[最近没多少事情，于是拿起来Delphi来看看，希望能基本掌握。以前一直希望学会一种PC编，从VB到VC++，再到这个Delphi，一直处于摇摆状态，不知道学哪个好，这次索性就定下用Delphi，能编出个小软件就可以了！<br/><br/>以前做过网页设计，用过ASP编程，也用过C语言/汇编来写单片机的程序，所以程序结构对我来说应该没多少问题！有一点编程经验，知道每种语言一般都会提供一些相关函数，于是刚刚接触就直接网上搜索Delphi提供的相关函数资料，嘿嘿，一搜准中，转过来与大家分享下，希望对大家有点用！<br/><br/><br/>函数由一句或多句代码组成，可以实现某个特定的功能。使用函数可以使代码更加易读、易懂，加快编程速度及减少重复代码。过程与函数类似，过程与函数最重要的区别在于，过程没有返回值，而函数能有返回值。 <br/><br/>　　在Delphi 7.0中，已为我们定义好了非常多的函数，大致分类有6种：数据类型转换函数、字符串、数组操作函数、文件、磁盘操作函数、内存、指针操作函数、数学运算函数、日期函数。 <br/><br/>　　在Delphi中调用函数，一般情况下可以直接使用函数即可，但由于有一些函数未包含在Uses中列出的单元中(默认单元有Windows,Messages,SysUtils,Variants,Classes,Graphics, Controls,Forms,Dialogs;)，所以需要我们手动添加单元。比如，MidStr函数就未包含在这些单元中，MidStr所属单元在StrUtils中，因此我们将StrUtils添加Uses中即可。 <br/><br/>　　在本手册中，凡是未包含在默认列出的单元中的函数，都标明了其所属的单元，使用时应当注意。 <br/><br/>　　<span style="color:Red">一、数据类型转换函数</span><br/> <br/>　　在我们编写程序当中，根据不同情况，会使用到多种数据类型。当要对不同的类型进行操作时，必须要将不同的类型转换成同样的类型。因此熟练地掌握数据类型的转换是非常重要的。 <br/><br/>　　<span style="color:Green">1.FloatToStr </span><br/>　　功能说明：该函数用于将“浮点型”转换成“字符型”。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　Edit1.Text := FloatToStr(1.981); </div></div><br/><br/>　　<span style="color:Green">2.IntToStr </span><br/>　　功能说明：该函数用于将“整数型”转换成“字符型”。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　S := IntToStr(10);(注：S为String类型变量。) </div></div><br/><br/>　　<span style="color:Green">3.IntToHex</span> <br/>　　功能说明：该函数用于将“十进制”转换成“十进制”。该函数有二个参数。第一个参数为要转换的十进制数据，第二个参数是指定使用多少位来显示十六进制数据。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　Edit1.Text := IntToHex(&#39;100&#39;, 2); <br/><br/>　　执行结果，Edit1.Text等于64。</div></div> <br/><br/>　　<strong>注意：Delphi没有提供专门的“十六进制”转换为“十进制”的函数。使用StrToInt函数可以实现这个功能。具体代码是：I := StrToInt(&#39;S\&#39; + &#39;64&#39;); 这时I等于100。加上一个&#39;S\&#39;即可将“十六进制”转换为“十进制”。</strong> <br/><br/>　　<span style="color:Green">4.StrToInt</span> <br/>　　功能说明：该函数用于将“字符型”转换成“整数型”。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　I := StrToInt(&#39;100&#39;); </div></div><br/><br/>　　<strong>注意：不能转换如 StrToInt(&#39;ab&#39;)或StrToInt(&#39;好&#39;)这样的类型，因为他们并不存在数字型。</strong> <br/><br/>　　<span style="color:Green">5.StrToFloat</span> <br/>　　功能说明：该函数用于将“字符型”转换成“浮点型”。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　N := StrToFloat(Edit1.Text); </div></div><br/><br/>　　<strong>注意：Edit1.Text中的内容为1.981(凡在Edit控件中显示的文本均为字符串)。N为Double类型，用于保存转换后的浮点型数据。</strong> <br/><br/>　　<span style="color:Red">二、字符串、数组操作函数</span> <br/>　　对字符串及数组的操作，是每个程序员必须要掌握的。熟练的使用这些函数，在编程时能更加得心应手。 <br/><br/>　　<span style="color:Green">1.Copy</span> <br/>　　功能说明：该函数用于从字符串中复制指定范围中的字符。该函数有3个参数。第一个参数是数据源(即被复制的字符串)，第二个参数是从字符串某一处开始复制，第三个参数是要复制字符串的长度(即个数)。最后函数返回一个新的字符串(即是我们指定要复制的字符串内容)。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　var <br/><br/>　　 　S: String; <br/><br/>　　 　MyStr: String; // 保存新的字符串 <br/><br/>　　begin <br/><br/>　　 　S := &#39;I Love China!&#39;; <br/><br/>　　//下面将获取I Love China中的“Love”字符串。 <br/><br/>　　MyStr := Copy(S, 3, 4); <br/><br/>　　end; <br/><br/>　　执行结果，MyStr等于“Love”，“Love”字符串在“I Love China!”中第3个位置开始，所以第二个参数为3，“Love”一共有4个字符，所以第三个参数为4。</div></div> <br/><br/>　　<span style="color:Green">2.Concat</span> <br/>　　功能说明：连接两个或多个字符串为一个字符串。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　var <br/><br/>　　 　S1, S2: String; <br/><br/>　　begin <br/><br/>　　 　S1 := Concat(&#39;A&#39;, &#39;B&#39;); // 连接两个字符串，S1变量等于AB。 <br/><br/>　　 　S2 := Concat(&#39;Borland&#39;, &#39; Delphi&#39;, &#39; 7.0&#39;); // 连接三个字符，S2变量等于Borland Delphi 7.0。 <br/><br/>　　end; </div></div><br/><br/>　　<span style="color:Green">3.Del&#101;te</span> <br/>　　功能说明：删除字符串中指定的字符串。该函数有三个参数。第一个参数为要进行处理的字符串，第二个参数为从何处开始删除，第三个参数为删除的字符个数。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　var <br/><br/>　　 　S: String; <br/><br/>　　begin <br/><br/>　　 　S := &#39;I Like Reading CPCW.&#39;; <br/><br/>　　 　// 下面的代码将删除S变量中的“C”字符。 <br/><br/>　　 　Del&#101;te(S, 16, 1); <br/><br/>　　end; <br/><br/>　　此时S变量则是I Like Reading PCW.(“C”已经不存在了)。</div></div> <br/><br/>　　<span style="color:Green">4.High</span> <br/>　　功能说明：返回数组下标的最大值。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　var <br/><br/>　　 　arrText: array[0..9] of Char; <br/><br/>　　 　i: Integer; <br/><br/>　　begin <br/><br/>　　 　i := High(arrText); // i的值则为9 <br/><br/>　　end; </div></div><br/><br/>　　<span style="color:Green">5.Ins&#101;rt</span> <br/>　　功能说明：插入一个字符(串)。该函数有三个参数。第一个参数为要插入的字符(串)，第二个参数为被插入字符串(源字符串)，第三个参数为从何处插入。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　var <br/><br/>　　 　S: String; <br/><br/>　　begin <br/><br/>　　 　S := &#39;Wat is your name?&#39;; <br/><br/>　　 　// 上面句子中的What单词查一个“h”字符，下面使用Ins&#101;rt函数将h添加进去。 <br/><br/>　　 　Ins&#101;rt(&#39;h&#39;, S, 2); // 将“h”从第2位处插入。 <br/><br/>　　end; </div></div><br/><br/>　　<span style="color:Green">6.LeftStr(所在单元：StrUtils)</span> <br/>　　功能说明：返回字符串左边指定个数的新字符(串)。该函数有两个参数。第一个参数为完整的字符串，第二个参数为指定个数。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　var <br/><br/>　　 　S, A: String; <br/><br/>　　begin <br/><br/>　　 　S := &#39;MSN Messenger&#39;; <br/><br/>　　 A := LeftStr(S, 3); // 从最左边开始，获取左边的三个字符。因此A变量则等于MSN。 <br/><br/>　　end; </div></div><br/><br/>　　<span style="color:Green">7.Length</span> <br/>　　功能说明：该函数用于统计指定字符串的长度(即个数)。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　var <br/><br/>　　nLen1, nLen2: Integer; // 用于保存字符串长度 <br/><br/>　　begin <br/><br/>　　 　nLen1 := Length(&#39;CPCW&#39;); <br/><br/>　　nLen2 := Length(&#39;电脑报&#39;); <br/><br/>　　end; <br/><br/>　　执行结果，nLen1等于4，nLen2等于6。由于一个汉字相当于两个字符的长度，所以3个汉字的长度为6。</div></div> <br/><br/>　　<span style="color:Green">8.Low</span> <br/>　　功能说明：返回数组下标的最小值。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　var <br/><br/>　　 　arrText: array[1..9] of Char; <br/><br/>　　 　i: Integer; <br/><br/>　　begin <br/><br/>　　 　i:= High(arrText); // i的值则为1 <br/><br/>　　end; </div></div><br/><br/>　　<span style="color:Green">9.LowerCase</span> <br/>　　功能说明：将字符(串)中的英文字符转换为小写。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　var <br/><br/>　　 　S, A: String; <br/><br/>　　begin <br/><br/>　　 　S := &#39;ABC&#39;; <br/><br/>　　 　A := UpperCase(S); // 经过UpperCase函数转换后，A则等于abc。 <br/><br/>　　end; </div></div><br/><br/>　　<span style="color:Green">10.MidStr(所在单元：StrUtils)</span> <br/>　　功能说明：返回指定范围内的字符串。该函数有三个参数。第一个参数为源字符串，第二个参数为起点，第三个参数为结束点。通过第二、第三个参数则可指定要复制字符串的范围。 <br/><br/>　　Copy函数与此函数类似。MidStr主要用于处理含有中文字符的字符串。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　var <br/><br/>　　 　S: String; <br/><br/>　　 　H: String; <br/><br/>　　begin <br/><br/>　　 　S := MidStr(&#39;China&#39;, 1, 2); // S变量为Ch <br/><br/>　　 　H := MidStr(&#39;电脑报&#39;, 1, 1); // H变量为“电”。如果使用Copy函数，则应是H := Copy(&#39;电脑报, 1, 2)，否则返回的将不是“电”字。因此在使用操作含有中文的字符串时，最好使用MidStr。 <br/><br/>　　end; </div></div><br/><br/>　　<span style="color:Green">11.Pos</span> <br/>　　功能说明：查找字符(串)所在位置。该函数有二个参数。第一个参数为要查找的字符(串)，第二个参数为被查找字符(串)。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　var <br/><br/>　　 　nPos: Integer; // 用于保存查找的字符所在位置 <br/><br/>　　begin <br/><br/>　　 　nPos := Pos(&#39;Like&#39;, &#39;I Like Reading!&#39;); <br/><br/>　　end; <br/><br/>　　此时nPos等于3。如果没有查找到，则nPos为0。</div></div> <br/><br/>　　<strong>注意：Pos函数在查找时是要区分字符大小的。如果要实现不区分大小，那么需要使用UpperCase或LowerCase函数将两个参数的字符(串)转换为“大写”或“小写”再进行查找。</strong> <br/><br/>　　<u><strong>另外还有一个查找字符(串)的函数----AnsiPos，该函数的使用方法与Pos函数完全一样。当你查找的是汉字时，最好使用AnsiPos函数。</strong></u> <br/><br/>　　<span style="color:Green">12.RightStr(所在单元：StrUtils)</span> <br/>　　功能说明：返回字符串右边指定个数的新字符(串)。该函数有两个参数。第一个参数为完整的字符串，第二个参数为指定个数。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　var <br/><br/>　　 　S, A: String; <br/><br/>　　begin <br/><br/>　　 　S := &#39;MSN Messenger&#39;; <br/><br/>　　 　A := RightStr(S, 3); // 从最右边开始，获取右边的三个字符。因此A变量则等于ger。 <br/><br/>　　end; </div></div><br/><br/>　　<span style="color:Green">13.SetLength</span> <br/>　　功能说明：设置字符串或动态数组长度。该函数有两个参数。第一个参数为要设置的字符串变量或动态数组变量，第二个参数为指定的长度，其取值范围在0到255之间。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　var <br/><br/>　　 　S: String; <br/><br/>　　 　arrText: array of Char; // 定义一个动态数组 <br/><br/>　　begin <br/><br/>　　 　SetLength(S, 10); // 当设置后，S变量只能赋值长度为10的字符串。 <br/><br/>　　 　SetLength(arrText, 10); // 只有使用SetLength为动态数组分配内存空间后才能使用动态数组。这句代码的作用相当于arrText: array[0..9] of Char <br/><br/>　　end; </div></div><br/><br/>　　<span style="color:Green">14.StrPCopy</span> <br/>　　功能说明：将字符串复制到字符数组中。该函数有两个参数。第一个参数为“目标数组”，第二个参数为“字符串”。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　var <br/><br/>　　 　arrChar: array[0..255] of Char; // 这里声明了长度为256的Char型数组 <br/><br/>　　begin <br/><br/>　　 　StrPCopy(arrChar, &#39;Come on, baby!&#39;); <br/><br/>　　end; </div></div><br/><br/>　　<span style="color:Green">15.Trim</span> <br/>　　功能说明：删除字符串左右两边的空格(无论左右两边有多少个空格均被全部删除)。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　var <br/><br/>　　 　S: String; <br/><br/>　　begin <br/><br/>　　 　S := &#39; Delphi 7.0 &#39;; <br/><br/>　　 　S := Trim(S); <br/><br/>　　end; </div></div><br/><br/>　　<span style="color:Green">16.TrimLeft</span> <br/>　　功能说明：删除字符串左边的空格(无论左边有多少个空格均被全部删除)。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　 　S := TrimLeft(&#39; Delphi&#39;); </div></div><br/><br/>　　<span style="color:Green">17.TrimRight</span> <br/>　　功能说明：删除字符串左边的空格(无论左边有多少个空格均被全部删除)。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　 　S := TrimRight(&#39;Delphi &#39;); </div></div><br/><br/>　　<span style="color:Green">18.UpperCase</span> <br/>　　功能说明：将字符(串)中的英文字符转换为大写。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　var <br/><br/>　　 　S, A: String; <br/><br/>　　begin <br/><br/>　　 　S := &#39;abc&#39;; <br/><br/>　　 　A := UpperCase(S); // 经过UpperCase函数转换后，A则等于ABC。 <br/><br/>　　end; </div></div><br/><br/>　　<span style="color:Red">三、文件、磁盘操作函数</span> <br/>　　软件大多都要对文件、磁盘进行操作。熟悉掌握这些函数可以帮助你轻松实现创建、删除、保存文件等功能。 <br/><br/>　　<span style="color:Green">1.Append</span> <br/>　　功能说明：追加内容到文件中。文件必须要存在。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　var <br/><br/>　　 　S: String; <br/><br/>　　 　F: TextFile; <br/><br/>　　begin <br/><br/>　　 　S := &#39;This is a book.&#39;; <br/><br/>　　AssignFile(F, &#39;C:\MyFile.txt&#39;); // 将C:\MyFile.txt文件与F变量建立连接，后面可以使用F变量对文件进行操作。 <br/><br/>　　 　Append(F); // 以追加的方式打开文件 <br/><br/>　　 　Writeln(F, S); // 将S变量中的内容追加到文本尾后。 <br/><br/>　　 　CloseFile(F); // 关闭文件 <br/><br/>　　end; </div></div><br/><br/>　　<span style="color:Green">2.AssignFile</span> <br/>　　功能说明：与指定的文件建立连接。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　var <br/><br/>　　 　F: TextFile; // 声明文本文件类型变量 <br/><br/>　　begin <br/><br/>　　 　AssignFile(F, &#39;C:\MyFile.txt&#39;); // 将C:\MyFile.txt文件与F变量建立连接，后面可以使用F变量对文件进行操作。 <br/><br/>　　end; </div></div><br/><br/>　　<span style="color:Green">3.ChDir</span> <br/>　　功能说明：改变当前目录(文件夹)。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　var <br/><br/>　　 　sDir: String; <br/><br/>　　begin <br/><br/>　　 　sDir := &#39;C:\Windows&#39;; <br/><br/>　　 　ChDir(sDir); // 此时，系统的当前目录则为C:\Windows目录。 <br/><br/>　　end; </div></div><br/><br/>　　<span style="color:Green">4.CloseFile</span> <br/>　　功能说明：关闭文件。当对文件的操作完成后，应该使用CloseFile函数关闭打开的文件。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　var <br/><br/>　　 　S: String; <br/><br/>　　 　AllText: String; <br/><br/>　　 　F: TextFile; <br/><br/>　　begin <br/><br/>　　AssignFile(F, &#39;C:\MyFile.txt&#39;); // 将C:\MyFile.txt文件与F变量建立连接，后面可以使用F变量对文件进行操作。 <br/><br/>　　 　Reset(F); // 打开文件 <br/><br/>　　 　while not EOF(F) do begin // 使用While循环，一直判断是否到了文件未尾 <br/><br/>　　 　　Readln(F, S); // 读取一行文本 <br/><br/>　　 　　AllText := AllText + S; <br/><br/>　　 　end; <br/><br/>　　 　CloseFile(F); // 关闭文件 <br/><br/>　　end; </div></div><br/><br/>　　<span style="color:Green">5.Del&#101;teFile</span> <br/>　　功能说明：删除指定的文件。该函数只有一个参数。此参数为欲删除文件的完整路径。如果删除成功，则返回True。若删除失败、或文件不存在则返回False。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　var <br/><br/>　　 　IsOK: Boolean; // 用于保存删除状态 <br/><br/>　　begin <br/><br/>　　 　IsOK := Del&#101;teFile(&#39;C:\My Documents\Index.html&#39;); // 函数执着后，将结果返回给IsOK变量。如果IsOK变量为True，则表示文件删除成功。 <br/><br/>　　 　if IsOK then ShowMessage(&#39;文件删除成功！&#39;) <br/><br/>　　 　else ShowMessage(&#39;文件删除失败！&#39;); <br/><br/>　　end; </div></div><br/><br/>　　<span style="color:Green">6.DirectoryExists</span> <br/>　　功能说明：检测指定的文件夹否存在。如果存在则返回True，反之则为False。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　var <br/><br/>　　 　IsExists: Boolean; <br/><br/>　　begin <br/><br/>　　 　IsExists := DirectoryExists (&#39;C:\Windows&#39;); <br/><br/>　　 　if IsExists then ShowMessage(&#39;Windows文件夹存在！&#39;) <br/><br/>　　 　else ShowMessage(&#39;Windows文件夹不存在！&#39;); <br/><br/>　　end; </div></div><br/><br/>　　<span style="color:Green">7.DiskFree </span><br/>　　功能说明：获取指定磁盘的剩余空间。该函数只有一个参数。该参数用于指定要获取剩余空间的磁盘号。当参数为0时，表示获取当前磁盘的剩余空间，1为A盘，2为B盘，以此类推。如果返回值为-1，表示指定的磁盘无效。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　var <br/><br/>　　 　FreeSize: Int64; <br/><br/>　　begin <br/><br/>　　 　FreeSize := DiskFree(3); // 获取C盘中的剩余空间。返回的值是以“字节”为单位的。 <br/><br/>　　end; </div></div><br/><br/>　　<span style="color:Green">8.DiskSize</span> <br/>　　功能说明：获取指定磁盘的空间。该函数只有一个参数。该参数用于指定要获取磁盘空间的磁盘号。当参数为0时，表示获取当前磁盘的空间，1为A盘，2为B盘，以此类推。如果返回值为-1，表示指定的磁盘无效。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　var <br/><br/>　　 　DiskSize: Int64; <br/><br/>　　begin <br/><br/>　　 　DiskSize:= DiskSize(3); // 获取C盘的空间。返回的值是以“字节”为单位的。 <br/><br/>　　end; </div></div><br/><br/>　　<span style="color:Green">9.EOF</span> <br/>　　功能说明：判断文件指针是否移动到了文件未尾。当EOF函数返回值为True时，则不可以使用Readln函数进行读取文件了。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　var <br/><br/>　　 　S: String; <br/><br/>　　 　AllText: String; <br/><br/>　　 　F: TextFile; <br/><br/>　　begin <br/><br/>　　AssignFile(F, &#39;C:\MyFile.txt&#39;); // 将C:\MyFile.txt文件与F变量建立连接，后面可以使用F变量对文件进行操作。 <br/><br/>　　 　Reset(F); // 打开文件 <br/><br/>　　 　while not EOF(F) do begin // 使用While循环，一直判断是否到了文件未尾 <br/><br/>　　 　　Readln(F, S); // 读取一行文本 <br/><br/>　　 　　AllText := AllText + S; <br/><br/>　　 　end; <br/><br/>　　end; </div></div><br/><br/>　　<span style="color:Green">10.Erase</span> <br/>　　功能说明：删除文件。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　var <br/><br/>　　 　F: File; <br/><br/>　　begin <br/><br/>　　AssignFile(F, &#39;C:\MyFile.txt&#39;); // 将C:\MyFile.txt文件与F变量建立连接，后面可以使用F变量对文件进行操作。 <br/><br/>　　 　Reset(F); // 打开文件 <br/><br/>　　 　CloseFile(F); // 关闭文件 <br/><br/>　　 　Erase(F); // 删除文件。在删除文件之前必须先关闭文件。 <br/><br/>　　end; </div></div><br/><br/>　　<span style="color:Green">11.FileExists</span> <br/>　　功能说明：检测指定的文件否存在。如果存在则返回True，反之则为False。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　var <br/><br/>　　 　IsExists: Boolean; <br/><br/>　　begin <br/><br/>　　 　IsExists := FileExists(&#39;C:\Test.txt&#39;); <br/><br/>　　 　if IsExists then ShowMessage(&#39;该文件存在！&#39;) <br/><br/>　　 　else ShowMessage(&#39;该文件不存在！&#39;); <br/><br/>　　end;</div></div> <br/><br/>　　<span style="color:Green">12.FileSize</span> <br/>　　功能说明：获取文件大小。返回的结果是字节为单位。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　var <br/><br/>　　 　F: file of Byte; <br/><br/>　　 　nSize: Longint; <br/><br/>　　begin <br/><br/>　　AssignFile(F, &#39;C:\MyFile.txt&#39;); // 将C:\MyFile.txt文件与F变量建立连接，后面可以使用F变量对文件进行操作。 <br/><br/>　　 　Reset(F); // 打开文件 <br/><br/>　　 　nSize := FileSize(F); // 获取文件大小。 <br/><br/>　　 　CloseFile(F); // 关闭文件 <br/><br/>　　end; </div></div><br/><br/>　　<span style="color:Green">13.ForceDirectories</span> <br/>　　功能说明：创建新的子目录。路径中不存在的目录将一同创建。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　ForceDirectories(&#39;C:\Flash\MyFolder&#39;); // 如果Flash文件夹本身不存的话，那么将会先创建Flash文件夹，然后再创建MyFolder文件夹。</div></div> <br/><br/>　　<span style="color:Green">14.MkDir</span> <br/>　　功能说明：创建一个新的子目录(文件夹)。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　MkDir(&#39;C:\MyFolder&#39;); // 在C盘根目录中创建了一个名叫MyFolder的文件夹。 <br/><br/>　　需要注意的是，如果在本身不存在的目录中创建子目录将会失败。比如C盘根本不存在Flash文件夹，写成MkDir(&#39;C:\Flash\MyFolder&#39;);这样将不能成功创建MyFolder文件夹。</div></div> <br/><br/>　　<span style="color:Green">15.Reset</span> <br/>　　功能说明：以只读方式打开文件。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　var <br/><br/>　　 　F: TextFile; // 声明文本文件类型变量 <br/><br/>　　begin <br/><br/>　　 　AssignFile(F, &#39;C:\MyFile.txt&#39;); // 将C:\MyFile.txt文件与F变量建立连接，后面可以使用F变量对文件进行操作。 <br/><br/>　　 　Reset(F); // 打开文件 <br/><br/>　　end; </div></div><br/><br/>　　<span style="color:Green">16.Rewrite</span> <br/>　　功能说明：以可写方式打开文件。如果文件不存在，将会自动创建。使用该函数，将会覆盖文件中的所有内容。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　var <br/><br/>　　 　F: TextFile; // 声明文本文件类型变量 <br/><br/>　　begin <br/><br/>　　 　AssignFile(F, &#39;C:\MyFile.txt&#39;); // 将C:\MyFile.txt文件与F变量建立连接，后面可以使用F变量对文件进行操作。 <br/><br/>　　 　Rewrite(F); // 打开文件。如果文件不存在，将会在C盘中创建MyFile.txt文件。如果文件存在，将会覆盖MyFile.txt中的所有内容。 <br/><br/>　　end; </div></div><br/><br/>　　<span style="color:Green">17.Readln</span> <br/>　　功能说明：读取一行文本。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　var <br/><br/>　　 　S: String; <br/><br/>　　 　F: TextFile; <br/><br/>　　begin <br/><br/>　　AssignFile(F, &#39;C:\MyFile.txt&#39;); // 将C:\MyFile.txt文件与F变量建立连接，后面可以使用F变量对文件进行操作。 <br/><br/>　　 　Reset(F); // 打开文件 <br/><br/>　　 　Readln(F, S); // 读取一行文本到S变量中 <br/><br/>　　end; </div></div><br/><br/>　　<span style="color:Green">18.Rename</span> <br/>　　功能说明：更改文件名。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　var <br/><br/>　　 　F: File; <br/><br/>　　begin <br/><br/>　　AssignFile(F, &#39;C:\MyFile.txt&#39;); // 将C:\MyFile.txt文件与F变量建立连接，后面可以使用F变量对文件进行操作。 <br/><br/>　　 　ReName(F, &#39;C:\NewFile.txt&#39;); // 更名为NewFile.txt <br/><br/>　　end; </div></div><br/><br/>　　<span style="color:Green">19.Writeln</span> <br/>　　功能说明：写入一行文本。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　var <br/><br/>　　 　S: String; <br/><br/>　　 　F: TextFile; <br/><br/>　　begin <br/><br/>　　 　S := &#39;This is a book.&#39;; <br/><br/>　　AssignFile(F, &#39;C:\MyFile.txt&#39;); // 将C:\MyFile.txt文件与F变量建立连接，后面可以使用F变量对文件进行操作。 <br/><br/>　　 　Rewrite(F); // 创建新文件 <br/><br/>　　 　Writeln(F, S); // 将S变量中的内容写入文本中。 <br/><br/>　　end; </div></div><br/><br/>　　<span style="color:Red">四、内存、指针操作函数</span> <br/>　　在编程中，动态数组为我们处理数据带来了很大的方便。Windows API函数也为增强程序的功能提供了强有力的保障。当我们在使用这些动态数组及API函数时，常常需要动态分配内存空间，这样动态数组才能被我们使用，API函数才能正确的返回结果。因此，这些函数是必不可少的。 <br/><br/>　　<span style="color:Green">1.AllocMem</span> <br/>　　功能说明：分配内存空间并自动初始化为零。如果不需要初始化为零，可以使用GetMem代替AllocMem。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　var <br/><br/>　　 　Buffer: PChar; <br/><br/>　　begin <br/><br/>　　 　Buffer := AllocMem(256); // 分配大小为256个字节的内存空间 <br/><br/>　　end; </div></div><br/><br/>　　<span style="color:Green">2.Dispose</span> <br/>　　功能说明：释放为指针分配的内存空间。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　var <br/><br/>　　 　P: Pinteger; // 声明一个Integer(整型)指针 <br/><br/>　　begin <br/><br/>　　 　New(P); <br/><br/>　　 　P^ := 100; <br/><br/>　　 　Dispose(P) // 释放内存 <br/><br/>　　end;</div></div> <br/><br/>　　<span style="color:Green">3.FreeMem</span> <br/>　　功能说明：释放分配的内存空间。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　var <br/><br/>　　 　Buffer: Pchar; <br/><br/>　　begin <br/><br/>　　 　GetMem(Buffer, 256); // 分配大小为256个字节的内存空间。 <br/><br/>　　 　FreeMem(Buffer); // 释放内存空间 <br/><br/>　　end;</div></div> <br/><br/>　　<span style="color:Green">4.GetMem</span> <br/>　　功能说明：分配内存空间。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　var <br/><br/>　　 　Buffer: PChar; <br/><br/>　　begin <br/><br/>　　 　GetMem(Buffer, 256); // 分配大小为256个字节的内存空间。 <br/><br/>　　end; </div></div><br/><br/>　　<span style="color:Green">5.New</span> <br/>　　功能说明：为指针分配内存空间。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　var <br/><br/>　　 　P: PInteger; // 声明一个Integer(整型)指针 <br/><br/>　　begin <br/><br/>　　 　New(P); // 分配内存 <br/><br/>　　 　P^ := 100; // 赋值 <br/><br/>　　end; </div></div><br/><br/>　　<span style="color:Red">五、数学运算函数</span> <br/>　　我们在编写跟数学紧密相关的程序时，数学运算函数将大有用处。比如图像处理软件，就会大量用到这些数学运算函数。 <br/><br/>　　默认情况下，Delphi新建的工程里，没有包含大多数的数学运行函数，因此需要在Uses中加入Math单元。 <br/><br/>　　<span style="color:Green">1.Abs</span> <br/>　　功能说明：求绝对值。 <br/><br/>　　参考实例： <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　var <br/><br/>　　 　r: Single; <br/><br/>　　 　i: Integer; <br/><br/>　　begin <br/><br/>　　 　r := Abs(-2.8); // r等于 2.8 <br/><br/>　　 　i := Abs(-156); // I 等于 156 <br/><br/>　　end; </div></div><br/><br/>　　<span style="color:Green">2.Exp</span> <br/>　　功能说明：Exp返回e的X次幂的值，其中e是一个自然对数基底。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　 　e := Exp(1.0); // e为real型变量 </div></div><br/><br/>　　<span style="color:Green">3.Floor</span> <br/>　　功能说明：取得小于等于X的最大的整数。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　Floor(-2.8) = -3 <br/><br/>　　Floor(2.8) = 2 <br/><br/>　　Floor(-1.0) = -1 </div></div><br/><br/>　　<span style="color:Green">4.Int</span> <br/>　　功能说明：返回参数中的整数部分。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　var <br/><br/>　　 　R: Real; <br/><br/>　　begin <br/><br/>　　 　R := Int(123.456); // R等于 123.0 <br/><br/>　　 　R := Int(-123.456); // R等于 -123.0 <br/><br/>　　end; </div></div><br/><br/>　　<span style="color:Green">5.Max(所在单元：Math)</span> <br/>　　功能说明：比较两个数字，并返回最大的一个数字。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　var <br/><br/>　　 　k: Integer; <br/><br/>　　begin <br/><br/>　　 　k := Max(10, 20); // k将为20 <br/><br/>　　end; </div></div><br/><br/>　　<span style="color:Green">6.Min(所在单元：Math)</span> <br/>　　功能说明：比较两个数字，并返回最小的一个数字。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　var <br/><br/>　　 　k: Integer; <br/><br/>　　begin <br/><br/>　　 　k := Min(10, 20); // k将为10 <br/><br/>　　end; </div></div><br/><br/>　　<span style="color:Green">7.PI </span><br/>　　功能说明：精确计算返回圆周率。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　var <br/><br/>　　 　x Extended; <br/><br/>　　begin <br/><br/>　　 　x := PI; // x等于3.1415926535897932385 <br/><br/>　　end; </div></div><br/><br/>　　<span style="color:Green">8.Round</span> <br/>　　功能说明：对一个实数进行四舍五入。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　var <br/><br/>　　 　I, j: Integer; <br/><br/>　　begin <br/><br/>　　 　i := Round(1.25); // i等于1 <br/><br/>　　 　j := Round(1.62); // j等于2 <br/><br/>　　end; </div></div><br/><br/>　　<span style="color:Green">9.Sqr</span> <br/>　　功能说明：取给定值的平方。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　var <br/><br/>　　 i: Integer; <br/><br/>　　begin <br/><br/>　　 i := Sqr(3); // i等于9 <br/><br/>　　end;</div></div> <br/><br/>　　<span style="color:Red">六、日期函数</span><br/>　　对日期的处理，一般在有日期限制的共享、商业软件中经常使用到。如果你打算编写一款有日期限制的软件，熟悉使用下面的函数即可以实现。 <br/><br/>　　<span style="color:Green">1.Date</span> <br/>　　功能说明：返回当前的日期。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　procedure TForm1.Button1Click(Sender: TObject); <br/><br/>　　begin <br/><br/>　　 　Label1.Caption := &#39;今天是：&#39; + DateToStr(Date); <br/><br/>　　end; <br/><br/>　　Label显示为：今天是2005年1月1日。</div></div> <br/><br/>　　<span style="color:Green">2.DateToStr</span> <br/>　　功能说明：将日期型转换为字符型。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　var <br/><br/>　　 　S: String; <br/><br/>　　begin <br/><br/>　　 　S := DateToStr(Date); <br/><br/>　　end; </div></div><br/><br/>　　<span style="color:Green">3.DateTimeToStr</span> <br/>　　功能说明：将DateTime型转换为字符型。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　var <br/><br/>　　 　S: String; <br/><br/>　　begin <br/><br/>　　 　S := DateTimeToStr(Now); <br/><br/>　　end; </div></div><br/><br/>　　<span style="color:Green">4.DayOfTheMonth(所在单元：DateUtils)</span> <br/>　　功能说明：获取指定日期的日。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　Label1.Caption := IntToStr(DayOfTheMonth(Now)); <br/><br/>　　假设当前日期为2005年1月2日，那么Label将显示为2。</div></div> <br/><br/>　　<span style="color:Green">5.DayOfTheWeek(所在单元：DateUtils)</span> <br/>　　功能说明：根据指定日期，获取星期几。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　Label1.Caption := IntToStr(DayOfTheMonth(Now)); <br/><br/>　　假设当前日期为2005年1月2日，那么Label将显示为7。根据返回的值来判断是周几。7表示星期天，1为星期一，依类类推。</div></div> <br/><br/>　　<span style="color:Green">6.DayOfTheYear(所在单元：DateUtils)</span> <br/>　　功能说明：根据指定日期，获取天数。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　Label1.Caption := IntToStr(DayOfTheYear(Now)); <br/><br/>　　假设当前日期为2005年1月2日，那么Label将显示为2。表示是2005年的第2天。</div></div> <br/><br/>　　<span style="color:Green">7.DayOf(所在单元：DateUtils)</span> <br/>　　功能说明：根据指定的日期，返回日。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　Label1.Caption := IntToStr(DayOf(Date)); <br/><br/>　　假设当前日期为2005年1月2日，那么Label将显示为2。</div></div> <br/><br/>　　<span style="color:Green">8.IsLeapYear</span> <br/>　　功能说明：根据指定的年，判断是否为闰年。可使用YearOf函数获取年。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　procedure TForm1.Button1Click(Sender: TObject); <br/><br/>　　begin <br/><br/>　　 　if IsLeapYear(YearOf(Date)) then ShowMessage(&#39;是闰年&#39;) <br/><br/>　　 　else ShowMessage(&#39;不是闰年&#39;); <br/><br/>　　end;</div></div> <br/><br/>　　<span style="color:Green">9.MonthOf(所在单元：DateUtils)</span> <br/>　　功能说明：根据指定的日期，返回月份。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　Label1.Caption := IntToStr(MonthOf(Date));</div></div> <br/><br/>　　假设当前日期为2005年1月2日，那么Label将显示为1。 <br/><br/>　　<span style="color:Green">10.Now</span> <br/>　　功能说明：返回当前日期及时间。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　procedure TForm1.Button1Click(Sender: TObject); <br/><br/>　　begin <br/><br/>　　 　Label1.Caption := &#39;现在是：&#39; + DateTimeToStr(Now); <br/><br/>　　end;</div></div> <br/><br/>　　<span style="color:Green">11.YearOf(所在单元：DateUtils)</span> <br/>　　功能说明：根据指定的日期，返回年。 <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.zjidea.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">　　参考实例： <br/><br/>　　Label1.Caption := IntToStr(YearOf(Date));</div></div> <br/><br/>　　假设当前日期为2005年1月2日，那么Label将显示为2005。]]></description>
		</item>
		
			<item>
			<link>http://www.zjidea.com/blog/article/delphi/20090716-1.htm</link>
			<title><![CDATA[在vista下安装DELPHI7 ]]></title>
			<author>lzq0323@yahoo.com.cn(相逢萍水)</author>
			<category><![CDATA[Delphi编程]]></category>
			<pubDate>Thu,16 Jul 2009 11:25:08 +0800</pubDate>
			<guid>http://www.zjidea.com/blog/default.asp?id=441</guid>
		<description><![CDATA[最近闲着无聊,就下载了delphi 7来玩玩,不过我的系统是Vasta,安装完后运行,提示不大兼容,不过不太影响!<br/><br/>不过还有一个问题,提示不能rename一个文件,想想这变态的Vasti,就知道肯定是当前的用户权限不够!知道这原因,你应该知道怎么解决这问题了吧?<br/><br/>第一步:修改“C:\Program Files\Borland\Delphi7\Bin”的权限.右击Bin目录--》属性--》安全--》编辑-》赋予users组modify权限,保存退出<br/><br/>第二步:修改“C:\Program Files\Borland\Delphi7\Projects”的权限,右击Projects目录--》属性--》安全--》编辑-》赋予users组modify权限,保存退出<br/><br/>做完这两步,你再打开Delphi7,是不是正常了?<br/><br/>]]></description>
		</item>
		
</channel>
</rss>
