1KOL 常用函数函数
2kol.pas
3//绝对值函数
4function Abs( X: Integer ): Integer;
5//64位加法
6function Add64( const X, Y: I64 ): I64;
7//内存分配函数
8function AllocMem( Size : Integer ) : Pointer;
9//Ansi字符串比较
10function AnsiCompareStr(const S1, S2: KOLString): Integer;
11//不区分大小写Ansi字符串比较
12function AnsiCompareStrNoCase(const S1, S2: KOLString): Integer;
13//比较文本
14function AnsiCompareText( const S1, S2: AnsiString ): Integer;
15// 比较Ansi字符串是否相等
16function AnsiEq( const S1, S2 : AnsiString ) : Boolean;
17//转换字符串为小写
18function AnsiLowerCase(const S: Ansistring): Ansistring;
19//转换字符串为大写
20function AnsiUpperCase(const S: Ansistring): Ansistring;
21//二进制转换为十进制
22function Binary2Int( const Value: AnsiString ) : Integer;
23//十六进制转十进制
24function cHex2Int( const Value : AnsiString) : Integer;
25//TColor转换为Color15
26function Color2Color15( Color: TColor ): WORD;
27// TColor转换为Color16
28function Color2Color16( Color: TColor ): WORD;
29// Color转RGB
30function Color2RGB( Color: TColor ): TColor;
31//混合两种Tcolor颜色
32function ColorsMix( Color1, Color2: TColor ): TColor;
33//截取字符串尾部的Len长度的字符串
34function CopyTail( const S : KOLString; Len : Integer ) : KOLString;
35//获取当前日期
36function Date: TDateTime;
37//格式化的日期格式
38function Date2StrFmt( const Fmt: KOLString; D: TDateTime ): KOLString;
39//日期时间,短格式
40function DateTime2StrShort( D: TDateTime ): AnsiString;
41//返回是一周的第几天
42function DayOfWeek(Date: TDateTime): Integer;
43// Double转Int64
44function Double2Int64( D: Double ): I64;
45// Double转Str
46function Double2Str( D: Double ): AnsiString;
47// Extended转Str
48function Extended2Str( E: Extended ): AnsiString;
49// Format函数
50function Format( const fmt: KOLString; params: Array of const ): KOLString;
51//取得文件夹下面的文件,返回StrList列表
52function GetFileList(const dir: Ansistring): PStrList;
53//取得文件夹下面的文件,Fmask指定要取得的扩展名,返回StrList列表
54function GetFileListStr(FPath{e.g.'c:\tmp\'}, FMask{e.g.'*.*'}: KOLString): KOLString;
55//得到临时文件夹的位置
56function GetTempDir : KOLString;
57//取得桌面工作区大小
58function GetWorkArea: TRect;
59// Hex转Int
60function Hex2Int( const Value : AnsiString) : Integer;
61//十进制转二进制
62function Int2Digs( Value, Digits : Integer ) : AnsiString;
63//十进制转十六进制
64function Int2Hex( Value : DWord; Digits : Integer ) : AnsiString;
65// Int扩展成Int64
66function Int2Int64( X: Integer ): I64;
67// Int转PChar
68procedure Int2PChar( s: PAnsiChar; Value: Integer );
69// 十进制转罗马字符
70function Int2Rome( Value: Integer ): AnsiString;
71//十进制转字符串
72function Int2Str( Value : Integer ) : AnsiString;
73//十进制转字符串
74function Int2StrEx( Value, MinWidth: Integer ): AnsiString;
75// Int64转Double
76function Int64_2Double( const X: I64 ): Double;
77//Int64转十六进制
78function Int64_2Hex( X: I64; MinDigits: Integer ): AnsiString;
79//Int64转str
80function Int64_2Str( X: I64 ): AnsiString;
81//构造Int64
82function MakeInt64( Lo, Hi: DWORD ): I64;
83//构造一个Point
84function MakePoint( X, Y: Integer ): TPoint;
85//构造Rect
86function MakeRect( Left, Top, Right, Bottom: Integer ): TRect; stdcall;
87// 构造SmallPoint
88function MakeSmallPoint( X, Y: Integer ): TSmallPoint;
89//Max函数
90function Max( X, Y: Integer ): Integer;
91//Min函数
92function Min( X, Y: Integer ): Integer;
93//对话框MsgBox函数
94function MsgBox( const S: KOLString; Flags: DWORD ): DWORD;
95// MsgOK对话框函数
96procedure MsgOK( const S: KOLString );
97//AnsiChar转Int
98function S2Int( S: PAnsiChar ): Integer;
99//对话框ShowMessage函数
100procedure ShowMessage( const S: KOLString );
101//对话框ShowMessage函数
102function ShowMsg( const S: KOLString; Flags: DWORD ): DWORD;
103// Str转DateTimeFmt函数
104function Str2DateTimeFmt( const sFmtStr, sS: KOLString ): TDateTime;
105// Str转DateTime
106function Str2DateTimeShort( const S: KOLString ): TDateTime;
107// Str转Double
108function Str2Double( const S: AnsiString ): Double;
109// Str转Extended
110function Str2Extended( const S: AnsiString ): Extended;
111// Str保存到File
112function Str2File( Filename: PKOLChar; Str: PAnsiChar ): Boolean;
113// Str转Int
114function Str2Int(const Value : AnsiString) : Integer;
115// Str转Int64
116function Str2Int64( const S: AnsiString ): I64;
117// StrCat
118function StrCat( Dest, Source: PAnsiChar ): PAnsiChar;
119// StrComp
120function StrComp(const Str1, Str2: PAnsiChar): Integer; assembler;
121// StrComp_NoCase不区分大小写
122function StrComp_NoCase(const Str1, Str2: PAnsiChar): Integer;
123//字符串复制
124function StrCopy( Dest, Source: PAnsiChar ): PAnsiChar; assembler;
125//字符串相等比较
126function StrEq( const S1, S2 : AnsiString ) : Boolean;
127//返回字符串长度
128function StrLen(const Str: PAnsiChar): Cardinal; assembler;
129//Pchar复制
130function StrPCopy(Dest: PAnsiChar; const Source: Ansistring): PAnsiChar;
131// StrReplace字符串替换函数
132function StrReplace( var S: AnsiString; const From, ReplTo: AnsiString ): Boolean;
133//系统时间转字符串函数
134function SystemTime2Str( const SystemTime : TSystemTime; const LocaleID : DWORD; const Flags : TTimeFormatFlags; const TimeFormat : PKOLChar ) : KOLString;
135//文本复制到剪贴板
136function Text2Clipboard( const S: AnsiString ): Boolean;
137//时间转字符串
138function Time2StrFmt( const Fmt: KOLString; D: TDateTime ): KOLString;
139//字符串去除空格函数
140function Trim( const S : KOLString): KOLString;
141//转换大写
142function UpperCase(const S: Ansistring): Ansistring;
143// UTF8转WideString
144function UTF8_2WideString( const s: AnsiString ): WideString;
145
146mirror.pas
147//Bool转Str
148function Bool2Str( const S: String ): String;
149//TColor转Str
150function Color2Str( Color: TColor ): String;
151
2kol.pas
3//绝对值函数
4function Abs( X: Integer ): Integer;
5//64位加法
6function Add64( const X, Y: I64 ): I64;
7//内存分配函数
8function AllocMem( Size : Integer ) : Pointer;
9//Ansi字符串比较
10function AnsiCompareStr(const S1, S2: KOLString): Integer;
11//不区分大小写Ansi字符串比较
12function AnsiCompareStrNoCase(const S1, S2: KOLString): Integer;
13//比较文本
14function AnsiCompareText( const S1, S2: AnsiString ): Integer;
15// 比较Ansi字符串是否相等
16function AnsiEq( const S1, S2 : AnsiString ) : Boolean;
17//转换字符串为小写
18function AnsiLowerCase(const S: Ansistring): Ansistring;
19//转换字符串为大写
20function AnsiUpperCase(const S: Ansistring): Ansistring;
21//二进制转换为十进制
22function Binary2Int( const Value: AnsiString ) : Integer;
23//十六进制转十进制
24function cHex2Int( const Value : AnsiString) : Integer;
25//TColor转换为Color15
26function Color2Color15( Color: TColor ): WORD;
27// TColor转换为Color16
28function Color2Color16( Color: TColor ): WORD;
29// Color转RGB
30function Color2RGB( Color: TColor ): TColor;
31//混合两种Tcolor颜色
32function ColorsMix( Color1, Color2: TColor ): TColor;
33//截取字符串尾部的Len长度的字符串
34function CopyTail( const S : KOLString; Len : Integer ) : KOLString;
35//获取当前日期
36function Date: TDateTime;
37//格式化的日期格式
38function Date2StrFmt( const Fmt: KOLString; D: TDateTime ): KOLString;
39//日期时间,短格式
40function DateTime2StrShort( D: TDateTime ): AnsiString;
41//返回是一周的第几天
42function DayOfWeek(Date: TDateTime): Integer;
43// Double转Int64
44function Double2Int64( D: Double ): I64;
45// Double转Str
46function Double2Str( D: Double ): AnsiString;
47// Extended转Str
48function Extended2Str( E: Extended ): AnsiString;
49// Format函数
50function Format( const fmt: KOLString; params: Array of const ): KOLString;
51//取得文件夹下面的文件,返回StrList列表
52function GetFileList(const dir: Ansistring): PStrList;
53//取得文件夹下面的文件,Fmask指定要取得的扩展名,返回StrList列表
54function GetFileListStr(FPath{e.g.'c:\tmp\'}, FMask{e.g.'*.*'}: KOLString): KOLString;
55//得到临时文件夹的位置
56function GetTempDir : KOLString;
57//取得桌面工作区大小
58function GetWorkArea: TRect;
59// Hex转Int
60function Hex2Int( const Value : AnsiString) : Integer;
61//十进制转二进制
62function Int2Digs( Value, Digits : Integer ) : AnsiString;
63//十进制转十六进制
64function Int2Hex( Value : DWord; Digits : Integer ) : AnsiString;
65// Int扩展成Int64
66function Int2Int64( X: Integer ): I64;
67// Int转PChar
68procedure Int2PChar( s: PAnsiChar; Value: Integer );
69// 十进制转罗马字符
70function Int2Rome( Value: Integer ): AnsiString;
71//十进制转字符串
72function Int2Str( Value : Integer ) : AnsiString;
73//十进制转字符串
74function Int2StrEx( Value, MinWidth: Integer ): AnsiString;
75// Int64转Double
76function Int64_2Double( const X: I64 ): Double;
77//Int64转十六进制
78function Int64_2Hex( X: I64; MinDigits: Integer ): AnsiString;
79//Int64转str
80function Int64_2Str( X: I64 ): AnsiString;
81//构造Int64
82function MakeInt64( Lo, Hi: DWORD ): I64;
83//构造一个Point
84function MakePoint( X, Y: Integer ): TPoint;
85//构造Rect
86function MakeRect( Left, Top, Right, Bottom: Integer ): TRect; stdcall;
87// 构造SmallPoint
88function MakeSmallPoint( X, Y: Integer ): TSmallPoint;
89//Max函数
90function Max( X, Y: Integer ): Integer;
91//Min函数
92function Min( X, Y: Integer ): Integer;
93//对话框MsgBox函数
94function MsgBox( const S: KOLString; Flags: DWORD ): DWORD;
95// MsgOK对话框函数
96procedure MsgOK( const S: KOLString );
97//AnsiChar转Int
98function S2Int( S: PAnsiChar ): Integer;
99//对话框ShowMessage函数
100procedure ShowMessage( const S: KOLString );
101//对话框ShowMessage函数
102function ShowMsg( const S: KOLString; Flags: DWORD ): DWORD;
103// Str转DateTimeFmt函数
104function Str2DateTimeFmt( const sFmtStr, sS: KOLString ): TDateTime;
105// Str转DateTime
106function Str2DateTimeShort( const S: KOLString ): TDateTime;
107// Str转Double
108function Str2Double( const S: AnsiString ): Double;
109// Str转Extended
110function Str2Extended( const S: AnsiString ): Extended;
111// Str保存到File
112function Str2File( Filename: PKOLChar; Str: PAnsiChar ): Boolean;
113// Str转Int
114function Str2Int(const Value : AnsiString) : Integer;
115// Str转Int64
116function Str2Int64( const S: AnsiString ): I64;
117// StrCat
118function StrCat( Dest, Source: PAnsiChar ): PAnsiChar;
119// StrComp
120function StrComp(const Str1, Str2: PAnsiChar): Integer; assembler;
121// StrComp_NoCase不区分大小写
122function StrComp_NoCase(const Str1, Str2: PAnsiChar): Integer;
123//字符串复制
124function StrCopy( Dest, Source: PAnsiChar ): PAnsiChar; assembler;
125//字符串相等比较
126function StrEq( const S1, S2 : AnsiString ) : Boolean;
127//返回字符串长度
128function StrLen(const Str: PAnsiChar): Cardinal; assembler;
129//Pchar复制
130function StrPCopy(Dest: PAnsiChar; const Source: Ansistring): PAnsiChar;
131// StrReplace字符串替换函数
132function StrReplace( var S: AnsiString; const From, ReplTo: AnsiString ): Boolean;
133//系统时间转字符串函数
134function SystemTime2Str( const SystemTime : TSystemTime; const LocaleID : DWORD; const Flags : TTimeFormatFlags; const TimeFormat : PKOLChar ) : KOLString;
135//文本复制到剪贴板
136function Text2Clipboard( const S: AnsiString ): Boolean;
137//时间转字符串
138function Time2StrFmt( const Fmt: KOLString; D: TDateTime ): KOLString;
139//字符串去除空格函数
140function Trim( const S : KOLString): KOLString;
141//转换大写
142function UpperCase(const S: Ansistring): Ansistring;
143// UTF8转WideString
144function UTF8_2WideString( const s: AnsiString ): WideString;
145
146mirror.pas
147//Bool转Str
148function Bool2Str( const S: String ): String;
149//TColor转Str
150function Color2Str( Color: TColor ): String;
151