Plugin API: Built-in functions

String functions

Function Returns Description
Length(s) integer Get length of string or element count of array.
RegexReplace(s, RegEx, Replacement, IgnoreCase) string Replace instances in string matched by regular expression. Caseless matching if IgnoreCase is True.
RegexMatch(s, RegEx, IgnoreCase) string Match first instance in string by regular expression. Caseless matching if IgnoreCase is True.
RegexMatchAll(s, RegEx, IgnoreCase, &Matches, &Positions) bool Match all instances in string by regular expression. Caseless matching if IgnoreCase is True. Matches is array of array of string that receives all matched instances, containing substrings by regular expression groups. Positions is array of array of integer that receives all matched instances, containing positions in base string of all matched regular expression groups.
Note: see _v function.
Replace(Text, FromText, ToText) string Replace occurrences in Text and return resulting string.
Copy(s, from, count) string Extract and return substring.
Pos(substr, s) integer Return position of substring in string. Returns 0 if not found.
DeleteStr(&s, from, count) none Delete substring from string.
Insert(s, &s2, pos) none Insert substring in string.
Uppercase(s) string Return string converted to uppercase.
Lowercase(s) string Return string converted to lowercase.
Trim(s) string Remove leading and trailing whitespaces.
Chr(i) char Convert character code to character symbol.
Ord(ch) integer Convert character symbol to character code.

File functions

Function Returns Description
SaveStringToFile(Text, FileName, Encoding) bool Save string to file. Encoding can be: enAnsi, enUtf8, enUtf8NoBom, enUcs2.
LoadStringFromFile(FName, Encoding) string Load string from file. Encoding can be: enAnsi, enUtf8, enUtf8NoBom, enUcs2.
LoadStringFromFileDetectEncoding(FName, &Encoding) string Guess file encoding and load string from file.
ExtractFileName(Path) string Extract only file name from full path.
ExtractFilePath(Path) string Extract only directory from full path.
ExtractFileExt(Path) string Extract file extension.
FileExists(Path) bool Returns true if file exists in filesystem.
DirectoryExists(Path) bool Returns true if directory exists in filesystem.
LoadFileToBitmap(InputFileName, BM) bool Load bitmap from file. BM must contain initialized TBitmap object.

Interaction functions

Function Returns Description
Alert(Msg) none Display message.
Prompt(Question, DefaultValue) string Display dialog for entering text value.
Confirm(Msg) bool Display OK/Cancel dialog. Returns True if OK was clicked.
BrowseForFolder(&initialFolder, browseTitle, mayCreateNewFolder) bool Display Browse for folder dialog. Returns True if OK was clicked. Selected folder is returned in initialFolder.

Execution functions

Function Returns Description
ExecuteFile(FileName, Parameters) none Execute/open specified file.
ExecuteCommand(Command, &OutputText) bool Execute specified command line and write output to OutputText. Returns true if successful.
CheckIsPhpAvailable() bool Returns true if php.exe is available for executing PHP scripts.
ExecutePhpScript(PhpParameters, ScriptName, ScriptParameters, &OutputText) bool Execute specified PHP script or Phar and write output to OutputText. Returns true if successful.

Math functions

Function Returns Description
Round(r) integer Convert real number to integer.
Random real Return random number 0 ≤ number < 1.

Type conversion functions

Function Returns Description
_t(Value) string Convert integer, real number or null to string.
StrToInt(s) integer Convert string to integer. Will throw exception if string does not contain valid integer.
ValidInt(sInt) bool Return True if string contains valid integer.
IsNull(Value) bool Return True if Value is null.

Array functions

Function Returns Description
Length(s) integer Get length of string or element count of array.
SetLength(&S, L) none Set length of array.
_v(Array, indexarray) string Access items of multi-dimensional arrays. Example: _v(m, [3, 1]) - access element (3, 1) of two-dimensional array m.

Locale functions

Function Returns Description
DateSeparator() string Return date separator.
TimeSeparator() string Return time separator.
ShortDateFormat() string Return short date format.
LongTimeFormat() string Return long date format.