Function List Reference
Application
WriteLn The WriteLn procedure writes a complete line of data to the selected output destination.
writeln(s: string);
Readln The ReadLn procedure reads a complete line of data from a text input.
Readln(question: string): string;
Log The Log procedure writes a complete line of data to the log.
log(s: string);
ShowMessage Display a string in a simple dialog with an OK button
ShowMessage(const Message: string);
ApplicationPath Find out where this program is running from
ApplicationPath: String;
HideApplication Hides the application
HideApplication;
ShowApplication Shows the application
ShowApplication;
Document
Document Active document related routines.
Document :TDocument
OpenDocument Open an existing document
OpenDocument(sFilename: string);
CreateNewDoc Creates a new document
CreateNewDoc(Title, S: String);
ActiveDocRevertToSaved Revert back to the original document before saved
ActiveDocRevertToSaved;
String
TStringList Holds a variable length list of strings
type TStringList;
TrimRight
TrimRight(const s : String) : String;
TrimLeft
TrimLeft(const s : String) : String;
TrimWhiteSpace
TrimWhiteSpace(const Search: string): string;
ReplaceString
ReplaceString(var S:String; const Src, Dest: String);
StringPos StringPos searches the first occurrence of a substring aSubstr in a string given by S without case sensitivity (upper and lower case characters are not differed). This function returns the index value of the first character of a specified substring from which it occurs in a given string starting with aOfs character index. If a specified substring is not found StringPos returns zero
StringPos(const aSubstr,S: String; aOfs: Integer): Integer;
StringProfile
StringProfile(const aFile, aSection, aEntry, aDefault: String): String;
Capitalize
Capitalize(const S: String): String;
BetweenString
BetweenString(const S, sLeft, sRight: String): String;
BaseToStr General function for converting binary, hex, octal or a custom base Key to a string.
BaseToStr(Value : longint; const Key : String; Digits : Byte) : String;
PadCut
PadCut(const s : String; PadLen : Integer; c : Char) : String;
Pad
Pad(const s : String; PadLen : Integer; c : Char) : String;
GetNthLine
GetNthLine(const S : string; LineNo : integer) : string;
GetSection
GetSection(atext,asection:string):string;
AnsiCompareStr
AnsiCompareStr(const S1, S2: string): Integer;
CompressWhiteSpace Returns a copy of given string with all white space characters replaced by space characters and all sequences of white space replaced by a single space character.
CompressWhiteSpace(const S: string): string;
CountDelims Returns count of all occurences of any of the given delimiter characters in the string S.
CountDelims(const S, Delims: string): Integer;
IsHexStr Returns true if string S contains only valid hex digits, false otherwise.
IsHexStr(const S: string): Boolean;
IsNumeric Checks if a string is a numeric value. Any leading and trailing spaces are ignored. If AllowFloat is true then the string may contain a real number, otherwise it must be an integer.
IsNumeric(Value: string; const AllowFloat: Boolean): Boolean;
ParseDelims Returns the sub-string of TextLine that begins at StartPos and is terminated by one of the delimiting characters Delims or the end of the string. StartPos is updated to index of character after delimiter. Returns '' if there is no sub-string after StartPos.
ParseDelims(const TextLine: string; var StartPos: Integer; const Delims: string): string;
TextWrap Word wraps text to a specified maximum width and pads left of each line with spaces to offset lines to a specified margin.
TextWrap(const Text: string; const Width, Margin: Integer): string;
TitleCase Converts a string to title case.
TitleCase(const S: string): string;
StringBeforeSeparator
StringBeforeSeparator(asource,aseparator:string):string;
StringAfterSeparator
StringAfterSeparator(asource,aseparator:string):string;
GetLineRange
GetLineRange(const S : string; StartLine, EndLine : integer) : string;
File
FileToString Stores content of a file in an ANSI string.
FileToStr(const FileName: string): string;
StringToFile Writes an ansi string to a text file.
StrToFile(const Str, FileName: string);
StringAppendToFile Appends an ansi string to an existing text file.
StringAppendToFile(aFile,aText:string);
DirectoryExists
DirectoryExists(const Directory: string): Boolean;
ChangeFileExt
ChangeFileExt(const FileName, Extension: string): string;
ExcludeTrailingBackslash
ExcludeTrailingBackslash(const S: string): string;
ExtractFileDir
ExtractFileDir(const FileName: string): string;
IncludeTrailingBackslash
IncludeTrailingBackslash(const S: string): string;
DeleteFile
DeleteFile(const FileName: string): Boolean;
ExtractFileExt
ExtractFileExt(const FileName: string): string;
ExtractFileName
ExtractFileName(const FileName: string): string;
ExtractFilePath
ExtractFilePath(const FileName: string): string;
IsUnicodeFile Checks if a file contains unicode text and returns true if so and false if not.
IsUnicodeFile(const FileName: string): Boolean;
CopyFile Copies Source file to Dest, preserving modification date.
CopyFile(const Source, Dest: string);
DeleteFiles Deletes all files in the directory Dir that match the given wildcard and returns the number of files deleted. If Wildcard is '' then all files are deleted. Sub-directories of Dir are not deleted.
DeleteFiles(const Dir, Wildcard: string): Integer;
RemoveFileExt Removes the extension from a file name. File name is unchanged if it has no extension.
RemoveFileExt(const FileName: string): string;
BrowseURL Activates default browser or email client for given URL. Returns true if browser/email client is uccessfully launched and false if not. Raises exception if URL doesn't conform to a known valid protocol.
BrowseURL(const URL: string): Boolean;
DownloadURLToFile Downloads file at URL and stores in given file. Returns true if download succeeds and false on failure. A connection to the internet must be open for download to succeed.
DownloadURLToFile(const URL, FileName: string): Boolean;
FileShellOpen
FileShellOpen(const aFile, aParam: String): Boolean;
LoadFilesByMask
LoadFilesByMask(const SpecDir, WildCard: string): string;
ZipGetFiles Returns the file list content from the zip file (aFile).
ZipGetFiles(aFile: String): String;
ZipExtractFiles Extract a zip file (aFile) based on the file lists (aList) given to the aDest directory.
ZipExtractFiles(aFile, aList, aDest: String): Boolean;
Log
PasteToActiveDoc
PasteToActiveDoc(S: String);
WriteToActiveDoc
WriteToActiveDoc(S: String);
AppendToActiveDoc
AppendToActiveDoc(S: String);
WriteToNewDoc
WriteToNewDoc(S: String);
Commands
RunDosCommand
RunDosCommand(DosApp:String): string;
ExeDosCommand
ExeDosCommand(cmd: string): string;
ConvertRtfToHtml
ConvertRtfToHtml(const Rtf: string; const DestPath: string; const SubDir: string): string;
SaveDocumentAs
SaveDocumentAs(sFilename: string): string;
TempFileName Returns a unique temporary file name in temporary folder. File name includes first three characters of Stub followed by hexadecimal characters. If Create is true file is created. Returns empty string on failure.
TempFileName(const Stub: string; const Create: Boolean): string;
Encode64
Encode64(S: string): string;
Decode64
Decode64(S: string): string;
StringDataToBitmapFile
StringDataToBitmapFile(const S: string; AFilename: string);
BitmapFileToStringData
BitmapFileToStringData(AFilename: string): string;
HTML
GetHTMLTag
GetHTMLTag(avalue:string):string;
MakeSafeHTMLText Replaces any characters in the given text that are HTML-compatible with suitable escaped versions and returns modified string.
MakeSafeHTMLText(TheText: string): string;
FormatXMLText
FormatXMLText(aText:string):string;
GetHTMLLinks
GetHTMLLinks(aFile:string):string;
GetHTMLAnchors
GetHTMLAnchors(aFile:string):string;
GetHTMLAttribute
GetHTMLAttribute(aName,aTag:string):string;
GetHTMLTag
GetHTMLTag(avalue:string):string;
System
CopyToClipboard
CopyToClipboard(S: String);
HostIPAddress Detects and returns the machine's local IP address or 0.0.0.0 if address is not found.
HostIPAddress: string;
SendKeysToWindow Sends key strokes to a window that corresponse to the characters in a string.
SendKeysToWindow(const HWnd: LongWord; const Text: string);
ExecAndWait Executes the given command line and waits for the program started by the command line to exit. Returns true if the program returns a zero exit code and false if the program doesn't start or returns a non-zero error code.
ExecAndWait(const CommandLine: string) : Boolean;
ExecAssociatedApp Executes the application associated with the given file name. Returns true if application is started successfully and false if not.
ExecAssociatedApp(const FileName: string): Boolean;
ExploreFolder Starts Windows Explorer to explore given folder. Returns true if folder is valid and can be explored, or false otherwise.
ExploreFolder(const Folder: string): Boolean;
OpenFolder Opens given folder in Windows Explorer. Returns true if folder is valid and can be opened, or false otherwise.
OpenFolder(const Folder: string): Boolean;
ComputerName Returns name of computer.
ComputerName: string;
TempFolder Returns path to Windows temporary folder.
TempFolder: string;
UserName Returns name of currently logged on user.
UserName: string;
GetEnvironment Extracts environment strings and sets Strings as Values array
GetEnvironment(Strings: TStrings);
GetParamList
GetParamList (var TS: TStringList);
GetEnvVarValue
GetEnvVarValue (EnvVar: String): string;
ExtractPattern
ExtractPattern(const APattern, AInputString : string) : string;
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License