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