functions:functions_list
Table of Contents
Functions
Functions can only be used in the “Populate Variables” Processor. Using Functions you can manipulate strings or numbers, do calculations, read files, parse JSON and much more. The execution of a function typically takes < 1ms, so it is about executing quick actions that are not worth inserting a processor into your workflow.
Usage description:
$function(input-1 = "string", input-2 = integer[, optional input-3 = "string"/integer])
- ALL string inputs containing alphabetic characters (a-z, A-Z) must be encapsulated with single or double quotes: “my string”, '123abc', “%s_variable%”, '%i_variable%'.
- Functions that accept numbers do not need to be encapsulated with quotes.
- If numeric character(s) (0-9) are used in functions that accept strings then the number will be treated as a string: 123 = “123”
- All functions can be nested (functions within functions):$replace($left(“my strings”, 6), “my”, “your”) = “your str”
- Nested function must NOT be encapsulated with quotes.See Nested Functions
Character String Functions
$left() | Get string n-characters from the left side. |
$triml() | Trim string n-characters from the left side. |
$right() | Get string n-characters from the right side. |
$trimr() | Trim string n-characters from the right side. |
$middle() | Get string n-characters from n-position. |
$between() | Get string between two strings. |
$upper() | Force string to upper case. |
$lower() | Force string to lower case. |
$proper() | Capitalizes every first letter following a non-alphanumeric character. |
$replace() | Replace string in string. |
$regreplace() | Replace string in string by regex pattern. |
$alrep() | Replace all non-alphanumeric characters and add optional exceptions. |
$leads() | Add leading character(s) to a string. If string to fill is omitted a zero (0) will be used. |
$trails() | Add trailing character(s) to a string. If fill-string is omitted a zero (0) will be used. |
$stripws() | Removes leading and trailing white spaces. |
$stripcrlf() | Strips string for line feed and carriage returns. |
$isdigit() | Check if string is only numbers. Success returns 1, failure returns 0. |
$isalpha() | Check if string is only alphabetic letters. Success returns 1, failure returns 0. |
$length() | Retrieves length of the string (number of characters). |
$reverse() | Reverse a string. |
Mathematics Functions
$round() | Round number to nearest decimal. |
$roundd() | Round number down to nearest integer. |
$roundu() | Round number up to nearest integer. |
$inttotc() | Convert integer to time code. |
$tctosec() | Convert time code to seconds. |
$abs() | Returns the absolute value of a number. |
$log() | Returns the natural logarithm of a number. |
$random() | Returns a random integer number between two integers. |
$count() | Count the number of times the specified string is found. |
Other Functions
$exists() | This is a file function that will tell if file(s) exists.Support recursing and returning a file list in array. |
$base64() | Encodes the input string as base 64. |
$base64dec() | Encodes the input UTF-8 string as terminated base64 string. |
$jsonencode() | Converts the input string to an JSON friendly string. |
$jsonget() | Retrieves the value from a JSON object key. Here is an example to retrieve values from ffprobe |
$jsonput() | Puts a value to a JSON object. |
$readarray() | Returns an instance from a valid array; “[data, data, etc…]”. |
$regext() | This is regular expression function. It extracts text based on recognition patterns. |
$hex() | Converts a decimal integer to hexadecimal number. |
$dec() | Converts a hexadecimal number to decimal integer. |
$guid() | Returns a random GUID/UUID. |
$xxhash() | Returns an eight character hash for any file. |
$xxhash64() | Returns an 16 character hash for any file. Must include full path. The hash is created using Yann Collet's xxHash which is very fast and suits large video files.. |
$read() | Reads the contents of a any text file. |
$urlencode() | Converts the input string to an URL friendly string. |
$week() | Returns the week number from the date specified in the parameters. If no date is specified, the function returns the current week number. |
$weekday() | Returns the week day number from the date specified in the parameters. If no date is specified, the function returns the current week day number. |
$lookup() | Loopup table for mapping data to other data. The function will only operate on array formated strings.. |
$lookupprep() | Loopup table for replacing strings with strings from lookup tables. |
$foreach() | This function will iterate and perform the desired operation on each data value. The result of each iteration will be put back into the array and presented as the new resulting array. |
$sort() | Sorts an array formated string or a regular string. String sorting use crl-f as base separator but a custom separator can be specified. |
$stringf() | This function works very much like the printf() function in C. It shares the same notation. The difference is that if you have multiple arguments you need to put them in an array. |
$fsize() | Get file size in bytes. |
$fext() | Get file extension. |
$fname() | Get file name. |
$fpath() | Get file path. |
$fdrive() | Get file drive. |
$asplit() | Splits an array string into a delimited string using the optional separator. Default separator is \r\n (carriage return and line feed). |
$ffconcat() | Creates a ffconcat version 1.0 compatible string for use with encoder input. |
$owner() | FInd the domain owner of a file. |
$waccess() | Check if user running the ffastrans system has write access to the specified folder.. |
$dateweek() | Finds the date (year_month_mday) of any given year, week number, week day number and week start day. |
$timecalc() | Calculates a new date/time by adding/subtracting a specified number of time intervals from an initial date/time. y = year, M = month, d = day, w = week, h = hour, m = minute, s = second. |
$shortcut() | Parse the shortcut (Windows) or alias (MAC) and return the actual file path. |
functions/functions_list.txt · Last modified: 2024/01/28 10:32 by benjamin