Delphi2010自带函数总结

 分类:Delphi, Other 阅读 (3,415)  Add comments
10月 252013
 

Delphi version: Delphi2010

1. SysUtils

//检查当前系统版本,如果当前系统版本大于等于AMajor.AMinor则返回true
function CheckWin32Version(AMajor: Integer; AMinor: Integer = 0): Boolean;
//获取文件版本
function GetFileVersion(const AFileName: string): Cardinal;
//将字符串转换为大写
function UpperCase(const S: string): string; overload;
function UpperCase(const S: string; LocaleOptions: TLocaleOptions): string; overload;
//将字符串转换为小写
function LowerCase(const S: string): string; overload;
function LowerCase(const S: string; LocaleOptions: TLocaleOptions): string; overload;
//比较两个字符串s1和s2,大小写第三,如果s1<s2返回小于0的值,如果s1=s2返回0,如果s1>s2返回大于0的值
function CompareStr(const S1, S2: string): Integer; overload;
function CompareStr(const S1, S2: string; LocaleOptions: TLocaleOptions): Integer; overload;
//判断两个字符串是否相等,大小写敏感,相等返回true,不相等返回false
function SameStr(const S1, S2: string): Boolean; overload;
function SameStr(const S1, S2: string; LocaleOptions: TLocaleOptions): Boolean; overload;
//比较p1和p2所指向的指定长度的内存,相等返回true,不相等返回false
function CompareMem(P1, P2: Pointer; Length: Integer): Boolean; assembler;
//比较两个字符串s1和s2,大小写不敏感,所有小写字母被转换为大写字母,如果s1<s2返回小于0的值,如果s1=s2返回0,如果s1>s2返回大于0的值
function CompareText(const S1, S2: string): Integer; overload;
function CompareText(const S1, S2: string; LocaleOptions: TLocaleOptions): Integer; overload;

//比较s1和s2是否相等,大小写不敏感,如果相等返回true,不相等返回false

function SameText(const S1, S2: string): Boolean; overload;
function SameText(const S1, S2: string; LocaleOptions: TLocaleOptions): Boolean; overload;

//

function AnsiUpperCase(const S: string): string; overload;
function AnsiLowerCase(const S: string): string; overload;
function AnsiCompareStr(const S1, S2: string): Integer; overload;
function AnsiSameStr(const S1, S2: string): Boolean; inline; overload;
function AnsiCompareText(const S1, S2: string): Integer; overload;
function AnsiSameText(const S1, S2: string): Boolean; inline; overload;
function AnsiStrComp(S1, S2: PAnsiChar): Integer; inline; overload;
function AnsiStrComp(S1, S2: PWideChar): Integer; inline; overload;
function AnsiStrIComp(S1, S2: PAnsiChar): Integer; inline; overload;
function AnsiStrIComp(S1, S2: PWideChar): Integer; inline; overload;
function AnsiStrLComp(S1, S2: PAnsiChar; MaxLen: Cardinal): Integer; overload;
function AnsiStrLComp(S1, S2: PWideChar; MaxLen: Cardinal): Integer; inline; overload;
function AnsiStrLIComp(S1, S2: PAnsiChar; MaxLen: Cardinal): Integer; overload;
function AnsiStrLIComp(S1, S2: PWideChar; MaxLen: Cardinal): Integer; inline; overload;
function AnsiStrLower(Str: PAnsiChar): PAnsiChar; overload;
function AnsiStrLower(Str: PWideChar): PWideChar; inline; overload;
function AnsiStrUpper(Str: PAnsiChar): PAnsiChar; overload;
function AnsiStrUpper(Str: PWideChar): PWideChar; inline; overload;
function AnsiLastChar(const S: AnsiString): PAnsiChar; overload;
function AnsiLastChar(const S: UnicodeString): PWideChar; overload;
function AnsiStrLastChar(P: PAnsiChar): PAnsiChar; overload;
function AnsiStrLastChar(P: PWideChar): PWideChar; overload;
function WideUpperCase(const S: WideString): WideString;
function WideLowerCase(const S: WideString): WideString;
function WideCompareStr(const S1, S2: WideString): Integer;
function WideSameStr(const S1, S2: WideString): Boolean; inline;
function WideCompareText(const S1, S2: WideString): Integer;
function WideSameText(const S1, S2: WideString): Boolean; inline;

//去掉头尾空格的函数

function Trim(const S: string): string; overload;
function TrimLeft(const S: string): string; overload;
function TrimRight(const S: string): string; overload;

//在字符串S的头和尾加上单引号

function QuotedStr(const S: string): string; overload;

//在字符串S的头和尾加上Quote,例如AnsiQuotedStr(‘b’, ‘c’)=cbc

function AnsiQuotedStr(const S: string; Quote: Char): string; overload;

//

function AnsiExtractQuotedStr(var Src: PAnsiChar; Quote: AnsiChar): AnsiString; overload;
function AnsiExtractQuotedStr(var Src: PWidechar; Quote: WideChar): UnicodeString; overload;

//如果S以AQuote开始和结尾,则去掉开始和结尾的AQuote,如果不是返回原字符串

function AnsiDequotedStr(const S: string; AQuote: Char): string; overload;

//将字符串中的换行符格式为指定的格式

function AdjustLineBreaks(const S: string; Style: TTextLineBreakStyle =
{$IFDEF LINUX} tlbsLF {$ENDIF}
{$IFDEF MACOSX} tlbsLF {$ENDIF}
{$IFDEF MSWINDOWS} tlbsCRLF {$ENDIF}): string; overload;

//

function IsValidIdent(const Ident: string; AllowDots: Boolean = False): Boolean;

//将整数型转换为字符串类型

function IntToStr(Value: Integer): string; overload;
function IntToStr(Value: Int64): string; overload;

//将无符号整数转换为字符串

function UIntToStr(Value: Cardinal): string; overload;
function UIntToStr(Value: UInt64): string; overload;

//将一个整数转换为十六进制字符串,Digits为最少显示多少位字符

function IntToHex(Value: Integer; Digits: Integer): string; overload;
function IntToHex(Value: Int64; Digits: Integer): string; overload;

//将一个字符串转换为整数,StrToIntDef中如果S为非整数格式字符串则返回Default

function StrToInt(const S: string): Integer; overload;
function StrToIntDef(const S: string; Default: Integer): Integer; overload;
function TryStrToInt(const S: string; out Value: Integer): Boolean; overload;

//将字符串转换为int64类型整数

function StrToInt64(const S: string): Int64; overload;
function StrToInt64Def(const S: string; const Default: Int64): Int64; overload;
function TryStrToInt64(const S: string; out Value: Int64): Boolean; overload;

//字符串类型转换为布尔类型

function StrToBool(const S: string): Boolean; overload;
function StrToBoolDef(const S: string; const Default: Boolean): Boolean; overload;
function TryStrToBool(const S: string; out Value: Boolean): Boolean; overload;

//从可执行程序的资源文件中根据Ident标识加载字符串

function LoadStr(Ident: Integer): string;

//从资源文件中加载字符串,并进行格式化操作

function FmtLoadStr(Ident: Integer; const Args: array of const): string;

//

function FileOpen(const FileName: string; Mode: LongWord): Integer;
function FileCreate(const FileName: string): Integer; overload; inline;
function FileCreate(const FileName: string; Rights: Integer): Integer; overload; inline;
function FileCreate(const FileName: string; Mode: LongWord; Rights: Integer): Integer; overload;
function FileRead(Handle: Integer; var Buffer; Count: LongWord): Integer;
function FileWrite(Handle: Integer; const Buffer; Count: LongWord): Integer;
function FileSeek(Handle, Offset, Origin: Integer): Integer; overload;
function FileSeek(Handle: Integer; const Offset: Int64; Origin: Integer): Int64; overload;
procedure FileClose(Handle: Integer); inline;
function FileAge(const FileName: string): Integer; overload; deprecated;
function FileExists(const FileName: string): Boolean;
function DirectoryExists(const Directory: string): Boolean;
function ForceDirectories(Dir: string): Boolean;

//
function FindFirst(const Path: string; Attr: Integer;var F: TSearchRec): Integer;
function FindNext(var F: TSearchRec): Integer;
procedure FindClose(var F: TSearchRec);
function FileGetDate(Handle: Integer): Integer;
function FileSetDate(const FileName: string; Age: Integer): Integer; overload;
function FileSetDate(Handle: Integer; Age: Integer): Integer; overload; platform;
function FileGetAttr(const FileName: string): Integer; platform;
function FileSetAttr(const FileName: string; Attr: Integer): Integer; platform; 
function FileIsReadOnly(const FileName: string): Boolean; inline;
function FileSetReadOnly(const FileName: string; ReadOnly: Boolean): Boolean;
function DeleteFile(const FileName: string): Boolean; inline;
function RenameFile(const OldName, NewName: string): Boolean; inline;
{ IsAssembly returns a boolean value that indicates whether the specified file is a .NET assembly. }
function IsAssembly(const FileName: string): Boolean;
function ChangeFileExt(const FileName, Extension: string): string; overload;
function ChangeFilePath(const FileName, Path: string): string; overload;
function ExtractFilePath(const FileName: string): string; overload;
function ExtractFileDir(const FileName: string): string; overload;
function ExtractFileDrive(const FileName: string): string; overload;
function ExtractFileName(const FileName: string): string; overload;
//获取文件的扩展名
function ExtractFileExt(const FileName: string): string; overload;
//将相对路径表示的文件名转换成绝对路径表示的文件名
function ExpandFileName(const FileName: string): string; overload;
function ExpandFileNameCase(const FileName: string; out MatchFound: TFilenameCaseMatch): string; overload;
function ExpandUNCFileName(const FileName: string): string; overload;
function ExtractRelativePath(const BaseName, DestName: string): string; overload;
function ExtractShortPathName(const FileName: string): string; overload;
function FileSearch(const Name, DirList: string): string;
function DiskFree(Drive: Byte): Int64;
function DiskSize(Drive: Byte): Int64;

//

function FileDateToDateTime(FileDate: Integer): TDateTime;
function DateTimeToFileDate(DateTime: TDateTime): Integer;
function GetCurrentDir: string;
function SetCurrentDir(const Dir: string): Boolean;
function CreateDir(const Dir: string): Boolean;
function RemoveDir(const Dir: string): Boolean;
//
function StrLen(const Str: PAnsiChar): Cardinal; overload;
function StrLen(const Str: PWideChar): Cardinal; overload;
function StrEnd(const Str: PAnsiChar): PAnsiChar; overload;
function StrEnd(const Str: PWideChar): PWideChar; overload;
function StrMove(Dest: PAnsiChar; const Source: PAnsiChar; Count: Cardinal): PAnsiChar; overload;
function StrMove(Dest: PWideChar; const Source: PWideChar; Count: Cardinal): PWideChar; overload;
function StrCopy(Dest: PAnsiChar; const Source: PAnsiChar): PAnsiChar; overload;
function StrCopy(Dest: PWideChar; const Source: PWideChar): PWideChar; overload;
function StrECopy(Dest: PAnsiChar; const Source: PAnsiChar): PAnsiChar; overload;
function StrECopy(Dest: PWideChar; const Source: PWideChar): PWideChar; overload;
function StrLCopy(Dest: PAnsiChar; const Source: PAnsiChar; MaxLen: Cardinal): PAnsiChar; overload;
function StrLCopy(Dest: PWideChar; const Source: PWideChar; MaxLen: Cardinal): PWideChar; overload;
function StrPCopy(Dest: PAnsiChar; const Source: AnsiString): PAnsiChar; overload;
function StrPCopy(Dest: PWideChar; const Source: UnicodeString): PWideChar; overload;
function StrPLCopy(Dest: PAnsiChar; const Source: AnsiString;
MaxLen: Cardinal): PAnsiChar; overload;
function StrPLCopy(Dest: PWideChar; const Source: UnicodeString;
MaxLen: Cardinal): PWideChar; overload;
function StrCat(Dest: PAnsiChar; const Source: PAnsiChar): PAnsiChar; overload;
function StrCat(Dest: PWideChar; const Source: PWideChar): PWideChar; overload;
function StrLCat(Dest: PAnsiChar; const Source: PAnsiChar; MaxLen: Cardinal): PAnsiChar; overload;
function StrLCat(Dest: PWideChar; const Source: PWideChar; MaxLen: Cardinal): PWideChar; overload;
function StrComp(const Str1, Str2: PAnsiChar): Integer; overload;
function StrComp(const Str1, Str2: PWideChar): Integer; overload;
function StrIComp(const Str1, Str2: PAnsiChar): Integer; overload;
function StrIComp(const Str1, Str2: PWideChar): Integer; overload;
function StrLComp(const Str1, Str2: PAnsiChar; MaxLen: Cardinal): Integer; overload;
function StrLComp(const Str1, Str2: PWideChar; MaxLen: Cardinal): Integer; overload;
function StrLIComp(const Str1, Str2: PAnsiChar; MaxLen: Cardinal): Integer; overload;
function StrLIComp(const Str1, Str2: PWideChar; MaxLen: Cardinal): Integer; overload;
function StrScan(const Str: PAnsiChar; Chr: AnsiChar): PAnsiChar; overload;
function StrScan(const Str: PWideChar; Chr: WideChar): PWideChar; overload;
function StrRScan(const Str: PAnsiChar; Chr: AnsiChar): PAnsiChar; overload;
function StrRScan(const Str: PWideChar; Chr: WideChar): PWideChar; overload;
function TextPos(Str, SubStr: PAnsiChar): PAnsiChar; overload;
function TextPos(Str, SubStr: PWideChar): PWideChar; overload;
function StrPos(const Str1, Str2: PAnsiChar): PAnsiChar; overload;
function StrPos(const Str1, Str2: PWideChar): PWideChar; overload;
function StrUpper(Str: PAnsiChar): PAnsiChar; overload;
function StrUpper(Str: PWideChar): PWideChar; overload;
function StrLower(Str: PAnsiChar): PAnsiChar; overload;
function StrLower(Str: PWideChar): PWideChar; overload;
function StrPas(const Str: PAnsiChar): AnsiString; overload;
function StrPas(const Str: PWideChar): UnicodeString; overload;
function AnsiStrAlloc(Size: Cardinal): PAnsiChar;
function WideStrAlloc(Size: Cardinal): PWideChar;
function StrAlloc(Size: Cardinal): PChar;
function StrBufSize(const Str: PAnsiChar): Cardinal; overload;
function StrBufSize(const Str: PWideChar): Cardinal; overload;
function StrNew(const Str: PAnsiChar): PAnsiChar; overload;
function StrNew(const Str: PWideChar): PWideChar; overload;
procedure StrDispose(Str: PAnsiChar); overload;
procedure StrDispose(Str: PWideChar); overload;
//
function Format(const Format: string;
const Args: array of const): string; overload;
function Format(const Format: string; const Args: array of const;
const FormatSettings: TFormatSettings): string; overload;
procedure FmtStr(var Result: string; const Format: string;
const Args: array of const); overload;
procedure FmtStr(var Result: string; const Format: string;
const Args: array of const; const FormatSettings: TFormatSettings); overload;
function StrFmt(Buffer, Format: PAnsiChar;
const Args: array of const): PAnsiChar; overload;
function StrFmt(Buffer, Format: PAnsiChar; const Args: array of const;
const FormatSettings: TFormatSettings): PAnsiChar; overload;
function StrFmt(Buffer, Format: PWideChar;
const Args: array of const): PWideChar; overload;
function StrFmt(Buffer, Format: PWideChar; const Args: array of const;
const FormatSettings: TFormatSettings): PWideChar; overload;
function StrLFmt(Buffer: PAnsiChar; MaxBufLen: Cardinal; Format: PAnsiChar;
const Args: array of const): PAnsiChar; overload;
function StrLFmt(Buffer: PAnsiChar; MaxBufLen: Cardinal; Format: PAnsiChar;
const Args: array of const;
const FormatSettings: TFormatSettings): PAnsiChar; overload;
function StrLFmt(Buffer: PWideChar; MaxBufLen: Cardinal; Format: PWideChar;
const Args: array of const): PWideChar; overload;
function StrLFmt(Buffer: PWideChar; MaxBufLen: Cardinal; Format: PWideChar;
const Args: array of const;
const FormatSettings: TFormatSettings): PWideChar; overload;
function FormatBuf(var Buffer; BufLen: Cardinal; const Format;
FmtLen: Cardinal; const Args: array of const): Cardinal; overload;
function FormatBuf(var Buffer; BufLen: Cardinal; const Format;
FmtLen: Cardinal; const Args: array of const;
const FormatSettings: TFormatSettings): Cardinal; overload;
function FormatBuf(Buffer: PWideChar; BufLen: Cardinal; const Format;
FmtLen: Cardinal; const Args: array of const): Cardinal; overload;
function FormatBuf(var Buffer: UnicodeString; BufLen: Cardinal; const Format;
FmtLen: Cardinal; const Args: array of const): Cardinal; overload;
function FormatBuf(Buffer: PWideChar; BufLen: Cardinal; const Format;
FmtLen: Cardinal; const Args: array of const;
const FormatSettings: TFormatSettings): Cardinal; overload;
function FormatBuf(var Buffer: UnicodeString; BufLen: Cardinal; const Format;
FmtLen: Cardinal; const Args: array of const;
const FormatSettings: TFormatSettings): Cardinal; overload;
function WideFormat(const Format: WideString;
const Args: array of const): WideString; overload;
function WideFormat(const Format: WideString;
const Args: array of const;
const FormatSettings: TFormatSettings): WideString; overload;
procedure WideFmtStr(var Result: WideString; const Format: WideString;
const Args: array of const); overload;
procedure WideFmtStr(var Result: WideString; const Format: WideString;
const Args: array of const; const FormatSettings: TFormatSettings); overload;
function WideFormatBuf(var Buffer; BufLen: Cardinal; const Format;
FmtLen: Cardinal; const Args: array of const): Cardinal; overload;
function WideFormatBuf(var Buffer; BufLen: Cardinal; const Format;
FmtLen: Cardinal; const Args: array of const;
const FormatSettings: TFormatSettings): Cardinal; overload;
//
function FloatToStr(Value: Extended): string; overload;
function FloatToStr(Value: Extended;
const FormatSettings: TFormatSettings): string; overload;
function CurrToStr(Value: Currency): string; overload;
function CurrToStr(Value: Currency;
const FormatSettings: TFormatSettings): string; overload;
function FloatToCurr(const Value: Extended): Currency;
function TryFloatToCurr(const Value: Extended; out AResult: Currency): Boolean;
function FloatToStrF(Value: Extended; Format: TFloatFormat;
Precision, Digits: Integer): string; overload;
function FloatToStrF(Value: Extended; Format: TFloatFormat;
Precision, Digits: Integer;
const FormatSettings: TFormatSettings): string; overload;
function CurrToStrF(Value: Currency; Format: TFloatFormat;
Digits: Integer): string; overload;
function CurrToStrF(Value: Currency; Format: TFloatFormat;
Digits: Integer; const FormatSettings: TFormatSettings): string; overload;
function FloatToText(BufferArg: PAnsiChar; const Value; ValueType: TFloatValue;
Format: TFloatFormat; Precision, Digits: Integer): Integer; overload;
function FloatToText(BufferArg: PWideChar; const Value; ValueType: TFloatValue;
Format: TFloatFormat; Precision, Digits: Integer): Integer; overload;
function FloatToText(BufferArg: PAnsiChar; const Value; ValueType: TFloatValue;
Format: TFloatFormat; Precision, Digits: Integer;
const FormatSettings: TFormatSettings): Integer; overload;
function FloatToText(BufferArg: PWideChar; const Value; ValueType: TFloatValue;
Format: TFloatFormat; Precision, Digits: Integer;
const FormatSettings: TFormatSettings): Integer; overload;
function FormatFloat(const Format: string; Value: Extended): string; overload;
function FormatFloat(const Format: string; Value: Extended;
const FormatSettings: TFormatSettings): string; overload;
function FormatCurr(const Format: string; Value: Currency): string; overload;
function FormatCurr(const Format: string; Value: Currency;
const FormatSettings: TFormatSettings): string; overload;
function FloatToTextFmt(Buf: PAnsiChar; const Value; ValueType: TFloatValue;
Format: PAnsiChar): Integer; overload;
function FloatToTextFmt(Buf: PAnsiChar; const Value; ValueType: TFloatValue;
Format: PAnsiChar; const FormatSettings: TFormatSettings): Integer; overload;
function FloatToTextFmt(Buf: PWideChar; const Value; ValueType: TFloatValue;
Format: PWideChar): Integer; overload;
function FloatToTextFmt(Buf: PWideChar; const Value; ValueType: TFloatValue;
Format: PWideChar; const FormatSettings: TFormatSettings): Integer; overload;
function StrToFloat(const S: string): Extended; overload;
function StrToFloat(const S: string;
const FormatSettings: TFormatSettings): Extended; overload;
function StrToFloatDef(const S: string;
const Default: Extended): Extended; overload;
function StrToFloatDef(const S: string; const Default: Extended;
const FormatSettings: TFormatSettings): Extended; overload;
function TryStrToFloat(const S: string; out Value: Extended): Boolean; overload;
function TryStrToFloat(const S: string; out Value: Extended;
const FormatSettings: TFormatSettings): Boolean; overload;
function TryStrToFloat(const S: string; out Value: Double): Boolean; overload;
function TryStrToFloat(const S: string; out Value: Double;
const FormatSettings: TFormatSettings): Boolean; overload;
function TryStrToFloat(const S: string; out Value: Single): Boolean; overload;
function TryStrToFloat(const S: string; out Value: Single;
const FormatSettings: TFormatSettings): Boolean; overload;
function StrToCurr(const S: string): Currency; overload;
function StrToCurr(const S: string;
const FormatSettings: TFormatSettings): Currency; overload;
function StrToCurrDef(const S: string;
const Default: Currency): Currency; overload;
function StrToCurrDef(const S: string; const Default: Currency;
const FormatSettings: TFormatSettings): Currency; overload;
function TryStrToCurr(const S: string; out Value: Currency): Boolean; overload;
function TryStrToCurr(const S: string; out Value: Currency;
const FormatSettings: TFormatSettings): Boolean; overload;
function TextToFloat(Buffer: PAnsiChar; var Value;
ValueType: TFloatValue): Boolean; overload;
function TextToFloat(Buffer: PAnsiChar; var Value; ValueType: TFloatValue;
const FormatSettings: TFormatSettings): Boolean; overload;
function TextToFloat(Buffer: PWideChar; var Value;
ValueType: TFloatValue): Boolean; overload;
function TextToFloat(Buffer: PWideChar; var Value; ValueType: TFloatValue;
const FormatSettings: TFormatSettings): Boolean; overload;
function HashName(Name: PAnsiChar): Cardinal;
procedure FloatToDecimal(var Result: TFloatRec; const Value;
ValueType: TFloatValue; Precision, Decimals: Integer);
//
function DateTimeToTimeStamp(DateTime: TDateTime): TTimeStamp;
function TimeStampToDateTime(const TimeStamp: TTimeStamp): TDateTime;
function MSecsToTimeStamp(MSecs: Comp): TTimeStamp;
function TimeStampToMSecs(const TimeStamp: TTimeStamp): Comp;
function EncodeDate(Year, Month, Day: Word): TDateTime;
function EncodeTime(Hour, Min, Sec, MSec: Word): TDateTime;
function TryEncodeDate(Year, Month, Day: Word; out Date: TDateTime): Boolean;
function TryEncodeTime(Hour, Min, Sec, MSec: Word; out Time: TDateTime): Boolean;
procedure DecodeDate(const DateTime: TDateTime; var Year, Month, Day: Word);
function DecodeDateFully(const DateTime: TDateTime; var Year, Month, Day,
DOW: Word): Boolean;
procedure DecodeTime(const DateTime: TDateTime; var Hour, Min, Sec, MSec: Word);
procedure DateTimeToSystemTime(const DateTime: TDateTime; var SystemTime: TSystemTime);
function SystemTimeToDateTime(const SystemTime: TSystemTime): TDateTime;
function DayOfWeek(const DateTime: TDateTime): Word;
function Date: TDateTime;
function Time: TDateTime;
function GetTime: TDateTime;
function Now: TDateTime;
function CurrentYear: Word;
function IncMonth(const DateTime: TDateTime; NumberOfMonths: Integer = 1): TDateTime;
procedure IncAMonth(var Year, Month, Day: Word; NumberOfMonths: Integer = 1);
procedure ReplaceTime(var DateTime: TDateTime; const NewTime: TDateTime);
procedure ReplaceDate(var DateTime: TDateTime; const NewDate: TDateTime);
function IsLeapYear(Year: Word): Boolean;
function DateToStr(const DateTime: TDateTime): string; overload; inline;
function DateToStr(const DateTime: TDateTime;
const FormatSettings: TFormatSettings): string; overload; inline;
function TimeToStr(const DateTime: TDateTime): string; overload; inline;
function TimeToStr(const DateTime: TDateTime;
const FormatSettings: TFormatSettings): string; overload; inline;
function DateTimeToStr(const DateTime: TDateTime): string; overload; inline;
function DateTimeToStr(const DateTime: TDateTime;
const FormatSettings: TFormatSettings): string; overload; inline;
function StrToDate(const S: string): TDateTime; overload;
function StrToDate(const S: string;
const FormatSettings: TFormatSettings): TDateTime; overload;
function StrToDateDef(const S: string;
const Default: TDateTime): TDateTime; overload;
function StrToDateDef(const S: string; const Default: TDateTime;
const FormatSettings: TFormatSettings): TDateTime; overload;
function TryStrToDate(const S: string; out Value: TDateTime): Boolean; overload;
function TryStrToDate(const S: string; out Value: TDateTime;
const FormatSettings: TFormatSettings): Boolean; overload;
function StrToTime(const S: string): TDateTime; overload;
function StrToTime(const S: string;
const FormatSettings: TFormatSettings): TDateTime; overload;
function StrToTimeDef(const S: string;
const Default: TDateTime): TDateTime; overload;
function StrToTimeDef(const S: string; const Default: TDateTime;
const FormatSettings: TFormatSettings): TDateTime; overload;
function TryStrToTime(const S: string; out Value: TDateTime): Boolean; overload;
function TryStrToTime(const S: string; out Value: TDateTime;
const FormatSettings: TFormatSettings): Boolean; overload;
function StrToDateTime(const S: string): TDateTime; overload;
function StrToDateTime(const S: string;
const FormatSettings: TFormatSettings): TDateTime; overload;
function StrToDateTimeDef(const S: string;
const Default: TDateTime): TDateTime; overload;
function StrToDateTimeDef(const S: string; const Default: TDateTime;
const FormatSettings: TFormatSettings): TDateTime; overload;
function TryStrToDateTime(const S: string;
out Value: TDateTime): Boolean; overload;
function TryStrToDateTime(const S: string; out Value: TDateTime;
const FormatSettings: TFormatSettings): Boolean; overload;
function FormatDateTime(const Format: string;
DateTime: TDateTime): string; overload; inline;
function FormatDateTime(const Format: string; DateTime: TDateTime;
const FormatSettings: TFormatSettings): string; overload;
procedure DateTimeToString(var Result: string; const Format: string;
DateTime: TDateTime); overload;
procedure DateTimeToString(var Result: string; const Format: string;
DateTime: TDateTime; const FormatSettings: TFormatSettings); overload;
function FloatToDateTime(const Value: Extended): TDateTime;
function TryFloatToDateTime(const Value: Extended; out AResult: TDateTime): Boolean;
//
function SysErrorMessage(ErrorCode: Cardinal): string;
function GetLocaleStr(Locale, LocaleType: Integer; const Default: string): string; platform;
function GetLocaleChar(Locale, LocaleType: Integer; Default: Char): Char; platform;
procedure GetFormatSettings;
procedure GetLocaleFormatSettings(LCID: Integer;
var FormatSettings: TFormatSettings);
//
function GetModuleName(Module: HMODULE): string;
function ExceptionErrorMessage(ExceptObject: TObject; ExceptAddr: Pointer;
Buffer: PChar; Size: Integer): Integer;
procedure ShowException(ExceptObject: TObject; ExceptAddr: Pointer);
procedure Abort;
procedure OutOfMemoryError;
procedure Beep; inline;
// MBCS functions
function ByteType(const S: AnsiString; Index: Integer): TMbcsByteType; overload;
function ByteType(const S: UnicodeString; Index: Integer): TMbcsByteType; overload;
function StrByteType(Str: PAnsiChar; Index: Cardinal): TMbcsByteType; overload;
function StrByteType(Str: PWideChar; Index: Cardinal): TMbcsByteType; overload;
function ByteToCharLen(const S: AnsiString; MaxLen: Integer): Integer; overload; inline;
function ByteToCharLen(const S: UnicodeString; MaxLen: Integer): Integer; overload; inline; deprecated ‘Use ElementToCharLen.’;
function ElementToCharLen(const S: AnsiString; MaxLen: Integer): Integer; overload;
function ElementToCharLen(const S: UnicodeString; MaxLen: Integer): Integer; overload;
function CharToByteLen(const S: AnsiString; MaxLen: Integer): Integer; overload; inline;
function CharToByteLen(const S: UnicodeString; MaxLen: Integer): Integer; overload; inline; deprecated ‘Use CharToElementLen.’;
function CharToElementLen(const S: AnsiString; MaxLen: Integer): Integer; overload;
function CharToElementLen(const S: UnicodeString; MaxLen: Integer): Integer; overload;
function ByteToCharIndex(const S: AnsiString; Index: Integer): Integer; overload; inline;
function ByteToCharIndex(const S: UnicodeString; Index: Integer): Integer; overload; inline; deprecated ‘Use ElementToCharIndex.’;
function ElementToCharIndex(const S: AnsiString; Index: Integer): Integer; overload;
function ElementToCharIndex(const S: UnicodeString; Index: Integer): Integer; overload;
function CharToByteIndex(const S: AnsiString; Index: Integer): Integer; overload; inline;
function CharToByteIndex(const S: UnicodeString; Index: Integer): Integer; overload; inline; deprecated ‘Use CharToElementIndex.’;
function CharToElementIndex(const S: AnsiString; Index: Integer): Integer; overload;
function CharToElementIndex(const S: UnicodeString; Index: Integer): Integer; overload;
function StrCharLength(const Str: PAnsiChar): Integer; overload;
function StrCharLength(const Str: PWideChar): Integer; overload;
function StrNextChar(const Str: PAnsiChar): PAnsiChar; inline; overload;
function StrNextChar(const Str: PWideChar): PWideChar; overload;
function CharLength(const S: AnsiString; Index: Integer): Integer; overload;
function CharLength(const S: UnicodeString; Index: Integer): Integer; overload;
function NextCharIndex(const S: UnicodeString; Index: Integer): Integer; overload;
function NextCharIndex(const S: AnsiString; Index: Integer): Integer; overload;
function IsLeadChar(C: AnsiChar): Boolean; overload; inline;
function IsLeadChar(C: WideChar): Boolean; overload; inline;
function CharInSet(C: AnsiChar; const CharSet: TSysCharSet): Boolean; overload; inline;
function CharInSet(C: WideChar; const CharSet: TSysCharSet): Boolean; overload; inline;
function IsPathDelimiter(const S: string; Index: Integer): Boolean; overload;
function IsDelimiter(const Delimiters, S: string; Index: Integer): Boolean; overload;
function IncludeTrailingPathDelimiter(const S: string): string; overload;
function IncludeTrailingBackslash(const S: string): string; platform; overload; inline;
function ExcludeTrailingPathDelimiter(const S: string): string; overload;
function ExcludeTrailingBackslash(const S: string): string; platform; overload; inline;
function LastDelimiter(const Delimiters, S: string): Integer; overload;
function FindDelimiter(const Delimiters, S: string; StartIdx: Integer = 1): Integer;
function AnsiCompareFileName(const S1, S2: string): Integer; inline; overload;
function SameFileName(const S1, S2: string): Boolean; inline; overload;
function AnsiLowerCaseFileName(const S: string): string; overload;
function AnsiUpperCaseFileName(const S: string): string; overload;
function AnsiPos(const Substr, S: string): Integer; overload;
function AnsiStrPos(Str, SubStr: PAnsiChar): PAnsiChar; overload;
function AnsiStrPos(Str, SubStr: PWideChar): PWideChar; overload;
function AnsiStrRScan(Str: PAnsiChar; Chr: AnsiChar): PAnsiChar; overload;
function AnsiStrRScan(Str: PWideChar; Chr: WideChar): PWideChar; inline; overload;
function AnsiStrScan(Str: PAnsiChar; Chr: AnsiChar): PAnsiChar; overload;
function AnsiStrScan(Str: PWideChar; Chr: WideChar): PWideChar; overload; inline;
function StringReplace(const S, OldPattern, NewPattern: string;
Flags: TReplaceFlags): string; overload;
function WrapText(const Line, BreakStr: string; const BreakChars: TSysCharSet;
MaxCol: Integer): string; overload;
function WrapText(const Line: string; MaxCol: Integer = 45): string; overload;
function FindCmdLineSwitch(const Switch: string; const Chars: TSysCharSet;
IgnoreCase: Boolean): Boolean; overload;
function FindCmdLineSwitch(const Switch: string): Boolean; overload;
function FindCmdLineSwitch(const Switch: string; IgnoreCase: Boolean): Boolean; overload;
procedure FreeAndNil(var Obj); inline;
// Interface support routines
function Supports(const Instance: IInterface; const IID: TGUID; out Intf): Boolean; overload;
function Supports(const Instance: TObject; const IID: TGUID; out Intf): Boolean; overload;
function Supports(const Instance: IInterface; const IID: TGUID): Boolean; overload;
function Supports(const Instance: TObject; const IID: TGUID): Boolean; overload;
function Supports(const AClass: TClass; const IID: TGUID): Boolean; overload;
function CreateGUID(out Guid: TGUID): HResult; stdcall;
function StringToGUID(const S: string): TGUID;
function GUIDToString(const GUID: TGUID): string;
function IsEqualGUID(const guid1, guid2: TGUID): Boolean; stdcall;
// Package support routines
function LoadPackage(const Name: string): HMODULE; overload;
function LoadPackage(const Name: string; AValidatePackage: TValidatePackageProc): HMODULE; overload;
procedure UnloadPackage(Module: HMODULE);
procedure GetPackageInfo(Module: HMODULE; Param: Pointer; var Flags: Integer;
InfoProc: TPackageInfoProc);
function GetPackageDescription(ModuleName: PChar): string;
procedure InitializePackage(Module: HMODULE); overload;
procedure InitializePackage(Module: HMODULE; AValidatePackage: TValidatePackageProc); overload;
procedure FinalizePackage(Module: HMODULE);
procedure RaiseLastOSError; overload;
procedure RaiseLastOSError(LastError: Integer); overload;
procedure RaiseLastWin32Error; deprecated ‘Use RaiseLastOSError’;
function Win32Check(RetVal: BOOL): BOOL; platform;
//Termination procedure support
procedure AddTerminateProc(TermProc: TTerminateProc);
function CallTerminateProcs: Boolean;
function GDAL: LongWord;
procedure RCS;
procedure RPR;

打赏
 Posted by on 2013-10-25