====== 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 [[functions:character_string_functions#Nested Functions|Nested Functions]] ==== Character String Functions ==== |< 100% 20% 80% >| |[[character_string_functions#$left vs $triml|$left()]]|Get string n-characters from the left side.| |[[character_string_functions#$left vs $triml|$triml()]]|Trim string n-characters from the left side.| |[[character_string_functions#$right vs $trimr|$right()]]|Get string n-characters from the right side.| |[[character_string_functions#$right vs $trimr |$trimr()]]|Trim string n-characters from the right side.| |[[character_string_functions#$middle vs $between |$middle()]]|Get string n-characters from n-position.| |[[character_string_functions#$middle vs $between |$between()]]|Get string between two strings.| |[[character_string_functions#$upper vs $lower and $proper|$upper()]]|Force string to upper case.| |[[character_string_functions#$upper vs $lower and $proper |$lower()]]|Force string to lower case.| |[[character_string_functions#$upper vs $lower and $proper |$proper()]]|Capitalizes every first letter following a non-alphanumeric character.| |[[character_string_functions#$replace and $alrep |$replace()]]|Replace string in string.| |[[character_string_functions#$regreplace |$regreplace()]]|Replace string in string by regex pattern.| |[[character_string_functions#$replace and $alrep |$alrep()]]|Replace all non-alphanumeric characters and add optional exceptions.| |[[character_string_functions#$leads vs $trails |$leads()]]|Add leading character(s) to a string. If string to fill is omitted a zero (0) will be used.| |[[character_string_functions#$leads vs $trails |$trails()]]|Add trailing character(s) to a string. If fill-string is omitted a zero (0) will be used.| |[[character_string_functions#$stripws and $stripcrlf |$stripws()]]|Removes leading and trailing white spaces.| |[[character_string_functions#$stripws and $stripcrlf|$stripcrlf()]]|Strips string for line feed and carriage returns.| |[[character_string_functions#$isdigit and $alpha|$isdigit()]]|Check if string is only numbers. Success returns 1, failure returns 0.| |[[character_string_functions#$isdigit and $alpha |$isalpha()]]|Check if string is only alphabetic letters. Success returns 1, failure returns 0.| |[[character_string_functions#$length and $reverse |$length()]]|Retrieves length of the string (number of characters).| |[[character_string_functions#$length and $reverse |$reverse()]]|Reverse a string.| ==== Mathematics Functions ==== |< 100% 20% 80% >| |[[mathematics_functions#$round and$roundd vs $roundu|$round()]]|Round number to nearest decimal.| |[[mathematics_functions#$round and$roundd vs $roundu |$roundd()]]|Round number down to nearest integer.| |[[mathematics_functions#$round and$roundd vs $roundu |$roundu()]]|Round number up to nearest integer.| |[[mathematics_functions#$inttotc vs $tctosec |$inttotc()]]|Convert integer to time code.| |[[mathematics_functions#$inttotc vs $tctosec |$tctosec()]]|Convert time code to seconds.| |[[mathematics_functions#$abs, $log and $random |$abs()]]|Returns the absolute value of a number.| |[[mathematics_functions#$abs, $log and $random |$log()]]|Returns the natural logarithm of a number.| |[[mathematics_functions#$abs, $log and $random |$random()]]|Returns a random integer number between two integers.| |[[mathematics_functions#$count |$count()]]|Count the number of times the specified string is found.| ==== Other Functions ==== |< 100% 20% 80% >| |[[other_functions#$exists|$exists()]]|This is a file function that will tell if file(s) exists.Support recursing and returning a file list in array.| |[[other_functions#$base64|$base64()]]|Encodes the input string as base 64.| |[[other_functions#$base64dec|$base64dec()]]|Encodes the input UTF-8 string as terminated base64 string.| |[[other_functions#$jsonencode_jsonget_and_jsonput|$jsonencode()]]|Converts the input string to an JSON friendly string.| |[[other_functions#$jsonencode_jsonget_and_jsonput|$jsonget()]]|Retrieves the value from a JSON object key. [[functions:other_functions#jsonget Usage Example to retrieve values from ffprobe|Here]] is an example to retrieve values from ffprobe| |[[other_functions#$jsonencode_jsonget_and_jsonput|$jsonput()]]|Puts a value to a JSON object.| |[[other_functions#$readarray|$readarray()]]|Returns an instance from a valid array; "[data, data, etc...]".| |[[other_functions#$regext|$regext()]]|This is regular expression function. It extracts text based on recognition patterns.| |[[other_functions#$hex and $dec|$hex()]]|Converts a decimal integer to hexadecimal number.| |[[other_functions#$hex and $dec|$dec()]]|Converts a hexadecimal number to decimal integer.| |[[other_functions#$guid|$guid()]]|Returns a random GUID/UUID.| |[[other_functions#$xxhash|$xxhash()]]|Returns an eight character hash for any file.| |[[other_functions#$xxhash64|$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..| |[[other_functions#$read|$read()]]|Reads the contents of a any text file.| |[[other_functions#$urlencode|$urlencode()]]|Converts the input string to an URL friendly string.| |[[other_functions#$week|$week()]]|Returns the week number from the date specified in the parameters. If no date is specified, the function returns the current week number.| |[[other_functions#$weekday|$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.| |[[other_functions#$lookup|$lookup()]]|Loopup table for mapping data to other data. The function will only operate on array formated strings..| |[[other_functions#$lookupprep |$lookupprep()]]|Loopup table for replacing strings with strings from lookup tables.| |[[other_functions#$foreach|$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.| |[[other_functions#$sort|$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.| |[[other_functions#$stringf|$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.| |[[other_functions#$fsize|$fsize()]]|Get file size in bytes.| |[[other_functions#$fext|$fext()]]|Get file extension.| |[[other_functions#$fname|$fname()]]|Get file name.| |[[other_functions#$fpath|$fpath()]]|Get file path.| |[[other_functions#$fdrive|$fdrive()]]|Get file drive.| |[[other_functions#$asplit|$asplit()]]|Splits an array string into a delimited string using the optional separator. Default separator is \r\n (carriage return and line feed).| |[[other_functions#$ffconcat|$ffconcat()]]|Creates a ffconcat version 1.0 compatible string for use with encoder input.| |[[other_functions#$owner|$owner()]]|FInd the domain owner of a file.| |[[other_functions#$waccess|$waccess()]]|Check if user running the ffastrans system has write access to the specified folder..| |[[other_functions#$dateweek|$dateweek()]]|Finds the date (year_month_mday) of any given year, week number, week day number and week start day.| |[[other_functions#$timecalc|$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.| |[[other_functions#$shortcut|$shortcut()]]|Parse the shortcut (Windows) or alias (MAC) and return the actual file path.| ----------------------------------------------                                                                                                           [[functions:functions_list|Back to top]]