function EnsureRange(const AValue, AMin, AMax: Double): Double;
判断AVaulu是否在[AMin,AMax]中
function IfThen(AValue: Boolean; const ATrue: Double; const AFalse: Double): Double;
如果AValue为真,则取ATrue的值,否则取AFalse值
function Compound(const R: Extended; N: Integer): Extended;
求(1+R)的N次方
procedure PolyX(const A: array of Double; X: Extended; var Poly: TPoly);
计算 A[0] + A[1]*X + ... + A[N]*X**N and X * its derivative.
function Hypot(const X, Y: Extended): Extended;
计算Sqrt(X*X+Y*Y)
function Ldexp(const X: Extended; const P: Integer): Extended;
计算X * (2^P)
function SumOfSquares(const Data: array of Double): Extended;
X*X+Y*Y+Z*Z+...
function Ceil(const X: Extended):Integer;
Ceil(-2.8) = -2 Ceil(2.8) = 3 Ceil(-1.0) = -1
function Exp(X: Real): Real;
Returns the exponential of X,or e^X.
function Frac(X: Extended): Extended;
Returns the fractional part of a real number.
const Infinity = 1.0 / 0.0;
function LnXP1(const X: Extended): Extended;
Returns the natural log of (X+1)
function RoundTo(const AValue: Double; const ADigit: TRoundToRange): Double;
Rounds a floating-point value to a specified digit or power of ten using branker's rounding?
Expression Value
RoundTo(1234567, 3) 1234000
RoundTo(1.234, -2) 1.23
RoundTo(1.235, -2) 1.24
RoundTo(1.245, -2) 1.24
function SimpleRoundTo(const AValue: Double; const ADigit: TSimpleRoundToRange = -2): Double;
Expression Value
SimpleRoundTo(1234567, 3) 1234000
SimpleRoundTo(1.234, -2) 1.23
SimpleRoundTo(1.235, -2) 1.24
SimpleRoundTo(-1.235, -2) -1.23
function Sign(const AValue: Double): TValueSign; overload;
function Sign(const AValue: Integer): TValueSign; overload;
function Sign(const AValue: Int64): TValueSign; overload;
Use Sign to test the sign of a numeric value. Sign returns
0 if AValue is zero.
1 if AValue is greater than zero.
-1 if AValue is less than zero.
首部 procedure Assert(expr : Boolean [; const msg: string]); $[System
功能 测试布尔表达式是否成功
说明 $ASSERTIONS ON/OFF | (long form)
$C +/- | (short form)
首部 function ByteToCharIndex(const S: string; Index: Integer): Integer; $[SysUtils
功能 返回索引Index的真实值
说明 如果Index小于和大于S的长度则返回0 ## ByteToCharIndex('12345678', 9) = 0;\
首部 function ChangeFileExt(const FileName, Extension: string): string; $[SysUtils
功能 改变文件的后缀返回。
说明 ##ChangeFileExt('zs.txt','.ini') = 'zs.ini';
首部 procedure ChDir(Path: <string>); $[System
功能 改变当前目录
说明 检查IOResult可确定此改变是否成功。IOResult的值非零时表示Path不存在。
首部 function CompareStr(const S1, S2: string): Integer; $[SysUtils
功能 比较两个字符串的大小。要区分大小写。
首部 function CompareText(const S1, S2: string): Integer; $[SysUtils
功能 比较两个字符串的大小。不区分大小写。
首部 function Concat(S1 [, S2,..., Sn]: <String>): string; $[System1
功能 把字串S1 [, S2,...,Sn]连接成一个单一的字串。
说明 除此之外,还可以用运算符+来连接。
首部 function Copy(S: <String>; Index, Len: Integer): string; $[System
功能 返回字符串S中由第Index个字符开始、Len个字符长的一个子串。
说明 若从S[Index]到结尾的长度小于len的值,则返回串S中由Index开始到串尾的那一子串。
首部 function CreateDir(const Dir: string): Boolean; $[SysUtils
功能 创建一个新的目录
说明 如果创建成功返回True,否则返回False
首部 function CurrToStr(Value: Currency): string; $[SysUtils
功能 将浮点类型参数Value转换成字符串返回
首部 function CycleToRad(Cycles: Extended): Extended; $[Math
功能 将参数Cycles转换成弧度返回。
说明 radians = 2pi*cycles。
首部 procedure DateTimeToSystemTime(DateTime: TDateTime; var SystemTime: TSystemTime); $[SysUtils
功能 将Delphi的日期时间类型参数DateTime转换为Windows的日期时间格式,返回至SystemTime。
首部 function DateTimeToTimeStamp(DateTime: TDateTime): TTimeStamp; $[SysUtils
功能 将Delphi的日期时间类型参数DateTime转换为Dos的日期时间格式返回。
首部 function DayOfWeek(Date: TDateTime): Integer; $[SysUtils
功能 返回参数Date星期的数值。
首部 procedure Dec(var X: <Ordinal> [ ; N: Longint]); $[System
功能 取有序变量X的第N个前趋。相当于for i := 1 to N do X := Rred(X);
说明 当不带参数N时,则N默认为1。用Dec比用与之等价的赋值语句执行得快。
首部 procedure Exit; $[System
功能 退出当前的执行程序模块。
说明 若从主程序退出,则程序终止;若从函数、过程中退出,则程序从调用该模块处往下继续执行。若从嵌套的块中退出,则从外部块中激活含Exit有块的下一语句开始执行。
首部 function ExtractFileExt(const FileName: string): string; $[SysUtils
功能 返回文件的扩展名。
首部 procedure FloatToDecimal(var DecVal: TFloatRec; const Value; ValueType: TFloatValue; Precision, Decimals: Integer); $[SysUtils
功能 将浮点数转换为十进制数
首部 function FormatDateTime(const Format: string; DateTime: TDateTime): string; $[SysUtils
功能 用指定的格式来格式化日期和时间
说明 c d(1-31) dd(01-31) ddd(Sun-Sat) dddd(Sunday-Saturday)
ddddd dddddd m(1-12) mm(01-12) mmm(Jan-Dec) mmmm(January-December)
yy(00-99) yyyy(0000-9999) h(0-23) hh(00-23) n(0-59) nn(0-59) s(0-59)
ss(00-59) t tt am/pm a/p ampm / : 'xx'/"xx"
首部 procedure Frame3D(Canvas: TCanvas; var Rect: TRect; TopColor, BottomColor: TColor; Width: Integer); $[extctrls
功能 在上Canvas画一个立体矩形。
说明 Rect指定范围,TopColor和BottomColor分别指定顶色和低色,Width指定边宽。
首部 function GraphicExtension(GraphicClass: TGraphicClass): string; $[Graphics
功能 返回图象的扩展名。
说明 Graphic class File extension returned
Tbitmap | bmp
Ticon | ico
Tmetafile | emf
TJPEGImage | jpg
首部 function Hi(X: <Integer>): Byte; $[System
功能 返回参数X的高位字节。
说明 函数Hi把X看作一个无符号数组,返回其市位字节。 ##Hi($1234) = $12
首部 function IncMonth(const Date: TDateTime; NumberOfMonths: Integer): TDateTime; $[SysUtils
功能 返回delphi的日期时间类型参数Date向后NumberOfMonths个月的值。
首部 function IncDay(const Date: TDateTime; NumberOfDays: Integer): TDateTime; $[SysUtils
功能 返回delphi的日期时间类型参数Date向后NumberOfDays: 天的值。
首部 function IncYear(const Date: TDateTime; NumberOfYears: Integer): TDateTime; $[SysUtils
功能 返回delphi的日期时间类型参数Date向后NumberOfYears: 年的值。
首部 function IncWeek(const Date: TDateTime; NumberOfWeeks: Integer): TDateTime; $[SysUtils
功能 返回delphi的日期时间类型参数Date向后NumberOfWeeks: 星期的值。
首部 function IncSecond(const AValue: TDateTime; const ANumberOfSeconds: Int64 = 1): TDateTime;
功能 返回delphi的日期时间类型参数Date向后NumberOfWeeks: 星期的值。
首部 function InputBox(const ACaption, APrompt, ADefault: string): string; $[Dialogs
功能 返回用户在输入框中输入的字符串。
说明 Acaption表示标题, APrompt表示提示,ADefault表示默认值。
首部 function IsPathDelimiter(const S: string; Index: Integer): Boolean; $[SysUtils
功能 返回参数S的第Index个位置是否为反斜杆。
说明 ##IsPathDelimiter(‘c:\pascal\zs.pas’,3) = True; IsPathDelimiter(‘c:\pascal\zs.pas’,2) = False;
首部 function MaxIntValue(const Data: array of Integer): Integer; $[Math
功能 返回整型数组Data元素中最大的一个值。
首部 function MaxValue(const Data: array of Double): Double; $[Math
功能 返回实型数组Data元素中最大的一个值。
首部 function Mean(const Data: array of Double): Extended; $[Math
功能 返回数组Data的平均值。
说明 ## Mean([1, 2, 3, 4, 5]) = 3; Mean([0.1, -32, 98, 13]) = 19.775;
首部 procedure MeanAndStdDev(const Data: array of Double; var Mean, StdDev: Extended); $[Math
功能 计算数组Data的平均数Mean和标准偏差StdDev。
首部 function MinIntValue(const Data: array of Integer): Integer; $[Math
功能 返回整型数组Data元素中最小的一个值。
首部 function MinValue(const Data: array of Double): Double; $[Math
功能 返回实型数组Data元素中最小的一个值。
首部 procedure MkDir(Path: string); $[System
功能 建立一由子目录Path串命名的新子目录。
说明 检查IOResult可以确定建立新子目录是否成功。
首部 procedure Move(const Source; var Dest; Count: Integer); $[System
功能 将变量Source中和前Count个字节传给变量Dest。
说明 ##var A: array[1..4] of Char; B: Integer; begin Move(A, B, SizeOf(B)); { SizeOf = safety! } end;
首部 procedure MomentSkewKurtosis(const Data: array of Double; var M1, M2, M3, M4, Skew, Kurtosis: Extended); $[Math
功能 对数组Data进行统计分析。
说明 M1 是平均数;M2 是变数;Skew = M3 / (M2**(3/2); Kurtosis = M4 / Sqr(M2);
首部 function Odd(X: Longint): Boolean; $[System
功能 测试参数X是否为奇数。
说明 X为奇数时,Odd返回值True,否则返回值False。
首部 function PasswordDialog(ASession: TComponent): Boolean; $[DBPWDlg
功能 返回用户输入的口今是否正确。
首部 function PopnVariance(const Data: array of Double): Extended; $[Math
功能 返回数组的平均值。{即:返回TotalVariance/N}
说明 参见TotalVariance。
首部 function QuotedStr(const S: string): string; $[SysUtils
功能 返回字符串S在Deiphi中的表示形式;
说明 ##QuotedStr(‘Zswang’) = ‘‘Zswang’’; QuotedStr(‘Zswang’)
首部 procedure RmDir(S: string); $[System
功能 删除由参数S给定的子目录。
说明 所删除的子目录必须是一个空目录。可由IOReult检测调用RmDir是否成功。
首部 function Round(X: Extended): Int64; $[System
功能 返回参数X的舍入整型值。{即:返回[X+0.5]}
说明 ##Round(1.4999) = 1; Round(1.500) = 2; Round(-1.4999) = -1; Round(-1.500) = -2;
首部 procedure Seek(var F; N: Longint); $[System
功能 将文件指针定位至文件F中序号为N的元素处。
说明 规定文件的第一个元素其序号为0。
首部 function SeekEoln [ (var F: Text) ]: Boolean; $[System
功能 返回正文文件F的行结束状态值。
说明 SeekEoln与Eoln功能 类似,但前者在返回行结束状态值前将跳略所有空格符和制表符。这在从一正文文件中读取数字值时是非常有用。它也有助于避免读取每最后一个字符之后的额外空格符。
首部 function SelectDirectory(var Directory: string; Options: TSelectDirOpts; HelpCtx: Longint): Boolean; overload; $[FileCtrl
function SelectDirectory(const Caption: string; const Root: WideString; out Directory: string): Boolean; overload;
功能 显示一个选择路径的对话筐,返回用户是否选择路径。
说明 type
TSelectDirOpt = (sdAllowCreate, sdPerformCreate, sdPrompt);
TSelectDirOpts = set of TSelectDirOpt;
## const
## SELDIRHELP = 1000;
## procedure TForm1.Button1Click(Sender: TObject);
## var
## Dir: string;
## begin
## Dir := 'C:\MYDIR';
## if SelectDirectory(Dir, [sdAllowCreate, sdPerformCreate, sdPrompt],SELDIRHELP) then
## Label1.Caption := Dir;
## end;
首部 procedure Set8087CW(NewCW: Word); $[System
功能 改变8087的指令代码Default8087CW。
说明 ## procedure NumericExample;
## var
## Saved8087CW: Word;
## begin
## Saved8087CW := Default8087CW;
## Set8087CW($133f); { Disable all fpu exceptions }
## ThirdPartyRoutine;
## Set8087CW(Saved8087CW);
## end;
首部 function SetCurrentDir(const Dir: string): Boolean; $[ SysUtils
功能 返回设置当前路径是否成功。
首部 procedure SinCos(Theta: Extended; var Sin, Cos: Extended) register; $[Math
功能 计算参数Theta的正弦值、余弦值,分别赋予变量Sin、Cos中。
说明 参数Theta以弧度为单位。
首部 function SLNDepreciation(Cost, Salvage: Extended; Life: Integer): Extended; $[Math
功能 根据成本、折旧率、和周期计算折旧。
说明 ** Life > 0
首部 function StdDev(const Data: array of Double): Extended; $[Math
功能 返回数组的标准偏差。
首部 function StrLCat(Dest, Source: PChar; MaxLen: Cardinal): PChar; $[SysUtils
功能 将一字符串中的字符附加到另一字符串尾并返回合并的字符串。
首部 function StrLComp(Str1, Str2: PChar; MaxLen: Cardinal): Integer; $[SysUtils
功能 返回以最大长度MaxLen比较字符串Str1和Str2的状态。
首部 function StrLCopy(Dest, Source: PChar; MaxLen: Cardinal): PChar; $[SysUtils
功能 将一个字符串中的字符复制到另一个字符串中。
功能 将字符串转换为整型或默认值。 [注]有安全性。
说明 ## StrToIntDef(‘1200’, 100) = 1200; StrToIntDef(‘$12’, 100) = 18; StrToIntDef(‘za$12’, 100) = 100;
首部 function Sum(const Data: array of Double): Extended register; $[Math
功能 返回实型数组Data所有元素之和。
说明 ##const a: array[1..6] of Double = (1.2, -3, 0.13, 54, 867.45, 3.141592654); var e: Extended; begin e := Sum(a); end;{e = 922.921592654}
首部 function SumInt(const Data: array of Integer): Integer register; $[Math
功能 返回整型数组Data所有元素之和。
说明 ##const a: array[1..6] of Integer = (2, 7, 89, -12, 5, 54); var i: Integer; begin i := SumInt(a); end;{i = 145}
首部 function Swap(X); $[System
功能 交换参数X的高位和低位字节。
说明 此函数一般用于16位Integer或Word数据类型。 ##Swan($1234) = $3412;
首部 function SYDDepreciation(Cost, Salvage: Extended; Life, Period: Integer): Extended; $[Math
功能 计算跌价后的资产。
首部 function SysErrorMessage(ErrorCode: Integer): string; $[SysUtils
功能 返回系统中错误代码所对应的API信息。
说明 此函可以有助于已习惯Windows编程的用户使用。
首部 function VarType(const V: Variant): Integer; $[System
功能 返回变体类型属性代码值。
说明 具体类型属性代码如下:
const
varEmpty = $0000;
varNull = $0001;
varSmallint = $0002;
varInteger = $0003;
varSingle = $0004;
varDouble = $0005;
varCurrency = $0006;
varDate = $0007;
varOleStr = $0008;
varDispatch = $0009;
varError = $000A;
varBoolean = $000B;
varVariant = $000C;
varUnknown = $000D;
varByte = $0011;
varString = $0100;
varTypeMask = $0FFF;
varArray = $2000;
varByRef = $4000;
首部 function WideCharLenToString(Source: PWideChar; SourceLen: Integer): string; $[System
功能 将Ansi字符串转换为UniCode字符串
说明
首部 function WideCharToString(Source: PWideChar): string; $[System
功能 将UniCode字符串转换为Ansi字符串
说明
首部 procedure WideCharToStrVar(Source: PWideChar; var Dest: string); $[System
功能 将UniCode字符串转换为Ansi字符串变量
说明
首部 function Win32Check(RetVal: Bool): Bool; $[SysUtils
功能
首部 function UpperCase(const S: string): string; $[SysUtils
功能 返回字符串S的大写形式。
说明 若S中的字符不在[‘a’..’z’]的范围,则不作改变。 ## UpperCase(‘Chinese’) = ‘CHINESE’; UppperCase(‘ZswangY37’) = ‘ZSWANGY37’;
首部 procedure Val(S: <String>; var V: <Integer>; var Code: Integer); $[System
功能 将字符串S转换成整型值。
说明 若字符串S中有非法字符,则将第一个出错的位置返回至Code中。如果Code的值为0则表示转换成功。
首部 function StringToWideChar(const Source:string;Dest:PWideChar;DestSize:integer):PWideChar;
功能 将String类型的字符串转换为Unicode的编码字符串,Dest参数指定目的串的缓冲区位置
说明
首部 procedure WideCharLenToStrVar(Source:PWideChar;SourceLen:integer;var Dest:string);
功能 将SourceLen长度的Unicode编码字符串转为单字节或多字节串,并赋值给Dest参数指定的字符串
说明
首部 procedure WideCharToStrVar(Source:PWideChar;var Dest:string);
功能 将给定的以NULL结尾的Unicode编码字符串转为单字节或多字节串,并赋值给Dest参数指定的字符串
说明
首部 procedure Delete(var S:string;Index,Count:integer);
功能 删除字符串中的子串
说明
首部 function DupeString(const AText:string;ACount:integer):string;
功能 将AText参数中的字符串复制ACount份并连接
说明 如:S:=DupeString('Ha',5); S为'HaHaHaHaHa'
首部 procedure Insert(Source:string;var s:string;Index:integer);
功能 在Source中的Index处插入子串s
说明
首部 function IsDelimiter(const Delimiters,S:string;Index:integer):boolean;
功能 表明字符串中的指定字符是否属于分隔符
说明 IsDelimiter('\,:.','C:\filename.exxt',2)返回True
首部 function LastDelimiter(const Delimiters,S:string):integer;
功能 表明字符串中最后一个属于分隔符集中的位置,从1开始计数
说明 MyIndex:=LastDelimiter('\.:','C:\filename.ext'); MyIndex值为12
首部 function pos(SubStr:string;s:string):integer;
功能 在s参数指定的字符串中查找子串SubStr的位置,如匹配,则返回头一个字符的位置
说明
首部 function MidStr(const AText:string;const AStart,ACount:integer):string;
功能 返回AText参数指定的字符串串中由AStart参数指定的序号的字符开始,ACount长度的子串
说明
首部 function LeftStr(const AText:string;ACount:integer):string;
功能 返回AText参数指定的字符串串中第一个字符开始,ACount长度的子串
说明
首部 function RightStr(const AText:string;ACount:integer):string;
功能 返回AText参数指定的字符串串中最右字符开始,ACount长度的子串
说明
首部 function ReverseString(const AText:string):string;
功能 返回AText参数指定的字符串的倒置串
说明
首部 function Str(X[:Width[:Decimal]];var S):string;
功能 将X格式化为字符串,并保存到S中
说明
首部 function StringOfChar(ch:char;count:integer):string;
功能 返回count个ch组成的字符串
说明 StringOfChar('A',4)返回'AAAA'
首部 function StuffString(const AText:string;AStart,ALength:Cardinal;const ASubText:string):string;
功能 用ASubText替换AText中的子串,开始位置由AStart指定,长度为ALength指定,若为0则只进行插入,而不替 换
说明
首部 function SameText(const S1,S2:string):boolean;
功能 忽略大小写的比较两个字符串是否相等
说明
首部 procedure SetText(var s:string;buffer:pchar;len:integer);
功能 忽略大小写的比较两个字符串是否相等
说明 将S内容置为buffer指定的缓冲区块内容,长度由len指定
首部 procedure Trim(s:string);
功能 去掉前导和结尾的空格和控制字符
说明
首部 procedure TrimLeft(s:string);
功能 去掉前导的空格和控制字符
说明
首部 procedure TrimRight(s:string);
功能 去掉结尾的空格和控制字符
说明
首部 (一)function WrapText(const Line, BreakStr: string; nBreakChars: TSysCharSet; MaxCol: Integer):string; overload;
(二)function WrapText(const Line, MaxCol: Integer = 45):string; overload;
功能 (一)WrapText在Line参数指定的字符串中查找nBreakChars参数指定的字符,并将查到的最后一处替换为 BreakStr指定的行分隔符,MaxCol指定一行的最大长度
(二)查找字符串中的空格符,连字符,制表符并替换为回车换行符
说明
首部 function AnsiStrScan(Str: PChar; Chr: Char): PChar;
功能 在Str中查找Chr,并指向第一个出现Chr的地方
说明
首部 procedure ProcessPath (const EditText: string; var Drive: Char; var DirPart: string; var FilePart: string);
功能 将给定的完整路径分为盘符,路径,文件名三部分
说明
首部 function FileIsReadOnly(const FileName: string): Boolean;
功能 找到并打开只读文件,但不能写;如果为只读,则返回True
说明
首部 procedure Truncate(var F);
功能 删除文件中当前位置以后的所有字符
说明
首部 function ChangeFileExt(const FileName, Extension: string): string;
功能 修改文件扩展名
说明