String
System
function Copy(S: String; Index: Integer; Count: Integer): string;
System.SysUtils
function StringReplace(const S, OldPattern, NewPattern: string; Flags: TReplaceFlags): string;function FormatDateTime(const Format: string; DateTime: TDateTime): string;function FormatFloat(const Format: string; Value: Extended): string;function FormatCurr(const Format: string; Value: Currency): string;function Trim(const S: string): string;function TrimLeft(const S: string): string; overload;function TrimRight(const S: string): string; overload;function QuotedStr(const S: string): string; overload;
比對字串 (不區分大小寫)
function CompareText(const S1, S2: string): Integer;
function UpperCase(const S: string): string;function UpperCase(const S: string; LocaleOptions: TLocaleOptions): string;function LowerCase(const S: string): string; overload;function LowerCase(const S: string; LocaleOptions: TLocaleOptions): string;function Languages: TLanguages;
System.StrUtils
回傳Text存在於Array裡的索引值 (區分大小寫)
function IndexStr(const AText: string; const AValues: array of string): Integer;
回傳Text存在於Array裡的索引值 (不區分大小寫)
function IndexText(const AText: string; const AValues: array of string): Integer;
function LeftStr(const AText: string; const ACount: Integer): string; overload;function RightStr(const AText: string; const ACount: Integer): string; overload;function MidStr(const AText: string; const AStart, ACount: Integer): string; overload;function ReverseString(const AText: string): string;
function SplitString(const S, Delimiters: string): TStringDynArray;
function IfThen(AValue: Boolean; const ATrue: string; AFalse: string = ''): string; overload;
Integer / Float
System
是否為奇數function Odd(X: Integer): Boolean;
procedure Inc(var X: Integer);procedure Inc(var X: Integer; N: Integer);
System.SysUtils
function StrToIntDef(const S: string; const Default: Extended): Extended;function StrToFloatDef(const S: string; const Default: Extended): Extended;function TryStrToFloat(const S: string; out Value: Extended): Boolean;function TryStrToCurr(const S: string; out Value: Currency): Boolean;function TryStrToInt(const S: string; out Value: Integer): Boolean; overload;
System.Math
平方function Power(const Base, Exponent: Double): Double;
將變數向上捨入至正無窮大。function Ceil(const X: Double): Integer;
將變數向負無窮方向舍入。function Floor(const X: Double): Integer;
Form.Width / 2 回傳浮點數Form.Width div 2 回傳整數值 (不計小數)
function Max(const A, B: Integer): Integer; overload;function MaxValue(const Data: array of Double): Double; overload;function MaxIntValue(const Data: array of Integer): Integer;function Min(const A, B: Integer): Integer; overload;function MinValue(const Data: array of Double): Double; overload;function MinIntValue(const Data: array of Integer): Integer;function InRange(const AValue, AMin, AMax: Int64): Boolean; overload;取整數function Int(const X: Extended): Extended;取小數function Frac(const X: Extended): Extended;
判斷正/負號
function Sign(const AValue: Integer): TValueSign;
Array中的平均值
function Mean(const Data: array of Single): Single;
function IfThen(AValue: Boolean; const ATrue: Integer; const AFalse: Integer = 0): Integer; overload;
Datetime
System.DateUtils
function IsPM(const AValue: TDateTime): Boolean;
function IsAM(const AValue: TDateTime): Boolean;
function IsValidDate(const AYear, AMonth, ADay: Word): Boolean;
傳回指定 TDateTime 值所在年份的週數。
function WeeksInYear(const AValue: TDateTime): Word;
傳回指定年份的週數。
function WeeksInAYear(const AYear: Word): Word;
傳回指定 TDateTime 值所在年份的天數。
function DaysInYear(const AValue: TDateTime): Word;
傳回指定年份的天數。
function DaysInAYear(const AYear: Word): Word;
傳回指定月份的天數。
function DaysInMonth(const AValue: TDateTime): Word;
傳回指定年份的指定月份的天數。
function DaysInAMonth(const AYear, AMonth: Word): Word;
function Today: TDateTime;
function Yesterday: TDateTime;
function Tomorrow: TDateTime;
function YearOf(const AValue: TDateTime): Word;
function MonthOf(const AValue: TDateTime): Word;
function WeekOf(const AValue: TDateTime): Word;
function DayOf(const AValue: TDateTime): Word;
function HourOf(const AValue: TDateTime): Word;
function MinuteOf(const AValue: TDateTime): Word;
function SecondOf(const AValue: TDateTime): Word;
function MilliSecondOf(const AValue: TDateTime): Word;
function StartOfTheMonth(const AValue: TDateTime): TDateTime;
function EndOfTheMonth(const AValue: TDateTime): TDateTime;
function StartOfAMonth(const AYear, AMonth: Word): TDateTime;
function EndOfAMonth(const AYear, AMonth: Word): TDateTime;
function StartOfTheWeek(const AValue: TDateTime): TDateTime;
function EndOfTheWeek(const AValue: TDateTime): TDateTime;
function StartOfAWeek(const AYear, AWeekOfYear: Word;const ADayOfWeek: Word = 1): TDateTime;
function EndOfAWeek(const AYear, AWeekOfYear: Word;const ADayOfWeek: Word = 7): TDateTime;
function YearsBetween(const ANow, AThen: TDateTime): Integer;
function MonthsBetween(const ANow, AThen: TDateTime): Integer;
function WeeksBetween(const ANow, AThen: TDateTime): Integer;
function DaysBetween(const ANow, AThen: TDateTime): Integer;
function HoursBetween(const ANow, AThen: TDateTime): Int64;
function MinutesBetween(const ANow, AThen: TDateTime): Int64;
function SecondsBetween(const ANow, AThen: TDateTime): Int64;
function MilliSecondsBetween(const ANow, AThen: TDateTime): Int64;
function IncYear(const AValue: TDateTime; const ANumberOfYears: Integer = 1): TDateTime; inline;
function IncWeek(const AValue: TDateTime;const ANumberOfWeeks: Integer = 1): TDateTime; inline;
指定天數偏移的日期
function IncDay(const AValue: TDateTime; const ANumberOfDays: Integer = 1): TDateTime; inline;
function IncHour(const AValue: TDateTime; const ANumberOfHours: Int64 = 1): TDateTime; inline;
function IncMinute(const AValue: TDateTime; const ANumberOfMinutes: Int64 = 1): TDateTime;
function IncSecond(const AValue: TDateTime; const ANumberOfSeconds: Int64 = 1): TDateTime;
function IncMilliSecond(const AValue: TDateTime; const ANumberOfMilliSeconds:Int64 = 1): TDateTime;
File/Fold
System.SysUtil
資料夾是否存在.function DirectoryExists(const Directory: string; FollowLink: Boolean = True): Boolean;檔案是否存在function FileExists(const FileName: string; FollowLink: Boolean = True): Boolean;檔案放置的資料夾function ExtractFileDir(const FileName: string): string;檔案放置的路徑function ExtractFilePath(const FileName: string): string;檔案放置的磁碟代號function ExtractFileDrive(const FileName: string): string;檔案名稱function ExtractFileName(const FileName: string): string;變更副檔名function ChangeFileExt(const FileName, Extension: string): string;檔案是否唯讀function FileIsReadOnly(const FileName: string): Boolean;檔案設定唯讀function FileSetReadOnly(const FileName: string; ReadOnly: Boolean): Boolean;刪除檔案function DeleteFile(const FileName: string): Boolean;檔案名稱更名function RenameFile(const OldName, NewName: string): Boolean;檔案搜尋function FileSearch(const Name, DirList: string): string;目前的使用路徑function GetCurrentDir: string;設定目前的使用路徑function SetCurrentDir(const Dir: string): Boolean;建立資料夾(樹狀)function ForceDirectories(Dir: string): Boolean;建立資料夾function CreateDir(const Dir: string): Boolean;移除資料夾function RemoveDir(const Dir: string): Boolean;
沒有留言:
張貼留言