SysUtils 是 Delphi 基礎運行庫中最核心的單元之一,提供了字串處理、日期時間、檔案操作、記憶體管理、轉換函數、異常處理等數百個常用函數與過程。本文將這些函數按功能分類整理,方便開發者快速查找與學習。
AnsiLowerCase、AnsiUpperCase、LowerCase、UpperCase、AnsiLowerCaseFileName、AnsiUpperCaseFileNameAnsiCompareStr、AnsiCompareText、AnsiSameStr、AnsiSameText、AnsiPos、AnsiStrPos、CompareStr、CompareText、SameStr、SameTextAnsiQuotedStr、AnsiExtractQuotedStr、AnsiDequotedStr、QuotedStr、ExtractFileName、ExtractFilePath、ExtractFileExt、ExtractFileDir、ExtractFileDriveTrim、TrimLeft、TrimRight、StringReplace、WrapText、AdjustLineBreaksNow、Date、Time、GetTimeEncodeDate、EncodeTime、DecodeDate、DecodeTime、DecodeDateFully、TryEncodeDate、TryEncodeTimeDateToStr、TimeToStr、DateTimeToStr、FormatDateTime、FormatFloat、FormatCurr、FloatToStr、FloatToStrF、CurrToStr、CurrToStrFIncMonth、IncAMonth、DayOfWeek、CurrentYear、DateTimeToFileDate、FileDateToDateTime、DateTimeToSystemTime、SystemTimeToDateTime、DateTimeToTimeStamp、TimeStampToDateTime、MSecsToTimeStamp、TimeStampToMSecs、ReplaceDate、ReplaceTimeFileExists、DirectoryExists、FileIsReadOnlyFileGetAttr、FileSetAttr、FileGetDate、FileSetDate、FileAge、FileSetReadOnlyFileOpen、FileCreate、FileRead、FileWrite、FileSeek、FileCloseCreateDir、RemoveDir、ForceDirectories、GetCurrentDir、SetCurrentDir、ExtractRelativePath、ExpandFileName、ExpandUNCFileName、ExtractShortPathNameFindFirst、FindNext、FindClose、FileSearchStrToInt、StrToIntDef、StrToInt64、StrToInt64Def、StrToFloat、StrToFloatDef、StrToCurr、StrToCurrDef、StrToBool、StrToBoolDef、StrToDate、StrToDateDef、StrToTime、StrToTimeDef、StrToDateTime、StrToDateTimeDefIntToStr、IntToHex、UIntToStr、FloatToStr、BoolToStrGetMem、FreeMem、ReallocMem、AllocMem、CompareMem、StrAlloc、StrDispose、StrNew、StrPas、StrPCopy、StrPLCopyCreateGUID、GUIDToString、StringToGUID、IsEqualGUID、SupportsShowException、ExceptionErrorMessage、RaiseLastOSError、RaiseLastWin32Error、OutOfMemoryErrorSysErrorMessage、Win32CheckCheckWin32Version、GetEnvironmentVariable、GetModuleName、GetPackageInfo、GetPackageDescriptionAnsiStrAlloc、AnsiStrComp、AnsiStrLComp、AnsiStrLIComp、AnsiStrUpper、AnsiStrLower、WideUpperCase、WideLowerCase、WideCompareStr、WideCompareText、WideSameStr、WideSameText、WideFormat、WideFormatBuf、WideFmtStrByteToCharIndex、ByteToCharLen、CharToByteIndex、CharToByteLen、CharLength、CharInSet、ElementToCharIndex、ElementToCharLen、CharToElementIndex、CharToElementLenLoadPackage、UnloadPackage、InitializePackage、FinalizePackage、GetPackageInfo、GetPackageDescription、SafeLoadLibraryAbort、Beep、Sleep、Randomize(實際在 System)、FreeAndNil、Format、FmtStr、FmtLoadStr、LoadStr、FindCmdLineSwitch、GetFormatSettings、GetLocaleFormatSettings、GetLocaleStr、GetLocaleCharSysUtils 已自動加入 uses,可直接使用。IsInLeapYear、WeekOf、DaysBetween)需額外引用 DateUtils。SysUtils 是否已提供現成函數。FreeAndNil 釋放物件,配合 try..finally 確保資源釋放。在 IDE 編輯器中按 Ctrl+Space 輸入 SysUtils. 即可列出所有公開符號;或將游標放在函數名上按 F1 打開線上幫助查看詳細參數說明。