For those that want to try the new functions out before the official release, following is a bit of documentation on how to use them:
$reverse(text)
Returns text
in reverse order.
$substr(text,start,end)
Returns the substring beginning with the character at the start
index, up to (but not including) the character at the end
index. Indexes are zero-based. Negative numbers will be counted back from the end of the string. If the start
or end
indexes are left blank, they will default to the start and end of the string respectively.
$find(haystack,needle)
Finds the location of one string within another. Returns the index of the first occurrance of needle
in haystack
, or -1 if needle
was not found.
$lenmulti(name,separator="; ")
Returns the number of elements in the multi-value tag name
. A literal value representing a multi-value can be substituted for name
, using the separator (or "; " if not passed) to coerce the value into a proper multi-valued tag.
$getmulti(name,index,separator="; ")
Gets the element at index
from the multi-value tag name
. A literal value representing a multi-value can be substituted for name
, using the separator (or "; " if not passed) to coerce the value into a proper multi-valued tag.
$slice(name,start,end,separator="; ")
Returns a multi-value variable containing the elements between the start
and end
indexes from the multi-value tag name
. A literal value representing a multi-value can be substituted for name
, using the separator (or "; " if not passed) to coerce the value into a proper multi-valued tag. Indexes are zero based. Negative numbers will be counted back from the end of the list. If the start
or end
indexes are left blank, they will default to the start and end of the list respectively.
For example, the following will create a multi-value variable with all artists in %artists%
except the first, which can be used to create a âfeat.â list.
$setmulti(supporting_artists,$slice(%artists%,1,))
$join(name,text,separator="; ")
Joins all elements in name
, placing text
between each element, and returns the result as a string.
$map(name,code,separator="; ")
Iterates over each element found in the multi-value tag name
and updates the value of the element to the value returned by code
, returning the updated multi-value tag. For each loop, the element value is first stored in the tag _loop_value
and the count is stored in the tag _loop_count
. This allows the element or count value to be accessed within the code
script.
$foreach(name,code,separator="; ")
Iterates over each element found in the multi-value tag name
, executing code
. For each loop, the element value is first stored in the tag _loop_value
and the count is stored in the tag _loop_count
. This allows the element or count value to be accessed within the code
script. A literal value representing a multi-value can be substituted for name
, using the separator (or "; " if not passed) to coerce the value into a proper multi-valued tag.
$while(condition,code)
Standard âwhileâ loop. Executes code
repeatedly until condition
no longer evaluates to True
. For each loop, the count is stored in the tag _loop_count
. This allows the element or count value to be accessed within the code
script. The function limites the maximum number of iterations to 1000 as a safeguard against accidentally creating an infinite loop.
$datetime(format=â%Y-%m-%d %H:%M:%Sâ)
Returns the current date and time in the specified format
, which is based on the standard Python strftime
format codes. If no format
is specified the date/time will be returned in the form â2020-02-05 14:26:32â.