Expression Function Reference
Type functions
coalesce(…Any)
The coalesce function returns the first non-null value.
| State | Expression | Result |
|---|---|---|
|
|
|
Array functions
push(array, …elements)
The push function adds a the specified elements to the end of the array and returns a new array.
The original array remains unchanged.
| State | Expression | Result |
|---|---|---|
|
|
|
|
|
|
|
|
|
pop(array)
The pop function returns the last element of the array.
The original array remains unchanged
| State | Expression | Result | ||
|---|---|---|---|---|
|
|
|
||
|
|
|
||
|
|
|
shift(array)
The shift function returns the first element of the array.
The original array remains unchanged
| State | Expression | Result | ||
|---|---|---|---|---|
|
|
|
||
|
|
|
||
|
|
|
count(array, …elements)
The count function returns the number of occurrences for the given elements.
The count function returns the length of the array if no element is provided.
| State | Expression | Result |
|---|---|---|
|
|
|
|
|
|
|
|
|
has(arr, …elements)
The has function checks if the provided array contains any of the elements.
The function returns true if elements are found, else it returns false.
| State | Expression | Result |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
hasAll(arr, …elements)
The hasAll function checks if the provided array contains all of the elements.
The function returns true if elements are found, else it returns false.
| State | Expression | Result |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
find(arr, elements)
The find function returns the position of the given element (zero-based numbering).
If the element does not exist, the function returns -1.
| State | Expression | Result |
|---|---|---|
|
|
|
|
|
|
|
|
|
sort(array, descending)
The sort function returns the sorted array, either ascending if the second parameter is false or descending if the second parameter is true.
The original array remains unchanged.
| State | Expression | Result |
|---|---|---|
|
|
|
|
|
|
splice(array, start, end)
The splice function returns a new array with elements from the start index up to (but not including) the end index.
The original array remains unchanged.
| State | Expression | Result | ||
|---|---|---|---|---|
|
|
|
||
|
|
|
String functions
trim(string)
The trim function removes all leading and trailing whitespace defined by the Unicode standard.
-
U+0020: Space, -
U+00A0: no-break space, -
U+1680: ogham space mark, -
U+180E: mongolian vowel separator, -
U+2000: en quad, -
U+2001: em quad, -
U+2002: en space, -
U+2003: em space, -
U+2004: three-per-em space, -
U+2005: four-per-em space, -
U+2006: six-per-em space, -
U+2007: figure space, -
U+2008: punctuation space, -
U+2009: thin space, -
U+200A: hair space, -
U+200B: zero width space, -
U+202F: narrow no-break space, -
U+205F: medium mathematical space, -
U+3000: ideographic space, -
U+FEFF: zero width no-break space.
| State | Expression | Result |
|---|---|---|
|
|
|
|
|
|
trimLeft(string, remove)
The trimLeft function removes the specified characters from the start of the string.
| State | Expression | Result |
|---|---|---|
|
|
|
|
|
|
trimRight(string, remove)
The trimRight function removes the specified characters from the end of the string.
| State | Expression | Result |
|---|---|---|
|
|
|
|
|
|
toLower(string)
The toLower function returns a new string with upper case letters mapped to their lower case counterpart.
| State | Expression | Result |
|---|---|---|
|
|
|
|
|
|
toUpper(string)
The toUpper function returns a new string with lower case letters mapped to their upper case counterpart.
| State | Expression | Result |
|---|---|---|
|
|
|
|
|
|
shortest(string1, …strings)
The shortest function returns the shortest string from the given arguments.
| State | Expression | Result |
|---|---|---|
|
|
|
|
|
|
longest(arg1, arg2, …a
The longest function returns the longest string from the given arguments.
| State | Expression | Result |
|---|---|---|
|
|
|
|
|
|
format(format, …arguments)
The format function returns a new constructed from the given template and arguments.
Refer to String Formatting for more details.
| State | Expression | Result |
|---|---|---|
|
|
|
title(string)
The title function turns the first character of to uppercase.
| State | Expression | Result |
|---|---|---|
|
|
|
|
|
|
untitle(string)
The untitle function turns does the opposite from what title(string) does.
| State | Expression | Result |
|---|---|---|
|
|
|
|
|
|
repeat(string, count)
The repeat function returns a new string where the original one is repeated count times.
| State | Expression | Result |
|---|---|---|
|
|
|
|
|
|
replace(string, old, new,
The replace function returns a copy of the string s with the first n non-overlapping instances of old replaced by new.
If old is empty, it matches at the beginning of the string and after each UTF-8 sequence, yielding up to k+1 replacements for a k-rune string.
If n < 0, there is no limit on the number of replacements.
| State | Expression | Result |
|---|---|---|
|
|
|
|
|
|
|
|
|
isUrl(string)
The isUrl function checks if the given string is a valid URL address.
If the string is a valid URL the function returns true else it returns false.
| State | Expression | Result |
|---|---|---|
|
|
|
|
|
|
isEmail(string)
The isEmail function checks if the given string is a valid email address.
If the string is a valid email the function returns true else it returns false.
| State | Expression | Result |
|---|---|---|
|
|
|
|
|
|
split(string, separator)
The split function returns an array of strings where the original string is split by the separator.
| State | Expression | Result |
|---|---|---|
|
|
|
|
|
|
join(strings, separator)
The join function joins the strings from the array into a single string separated by the separator.
| State | Expression | Result |
|---|---|---|
|
|
|
hasSubstring(string, substring, case)
The hasSubstring function checks if the given string contains the substring.
When the third argument is true the function is case sensitive else it is not.
| State | Expression | Result |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
substring(string, start, end)
The substring function returns the substring of the given string.
Both start and end are inclusive ([start, end])
| State | Expression | Result |
|---|---|---|
|
|
|
|
|
|
|
|
|
hasPrefix(string, prefix)
The hasPrefix function checks if the given string includes the prefix.
If the prefix exists the function returns true else it returns false.
| State | Expression | Result |
|---|---|---|
|
|
|
|
|
|
|
|
|
hasSuffix(string, prefix)
The hasSuffix function checks if the given string includes the suffix.
If the suffix exists the function returns true else it returns false.
| State | Expression | Result |
|---|---|---|
|
|
|
|
|
|
|
|
|
shorten(string, type, count)
The shorten function cuts off the given string at count characters or words when type is set to char.
The string is suffixed with ellipsis after the cutoff point.
| State | Expression | Result |
|---|---|---|
|
|
|
camelize(string)
The camelize function returns a new string in the camelCase form.
| State | Expression | Result |
|---|---|---|
|
|
|
snakify(string)
The snakify function returns a new string in the snake_case form.
| State | Expression | Result |
|---|---|---|
|
|
|
match(string, regex)
The match function checks if the string matches the given regular expression.
State |
Expression |
Result |
base64encode(string)`
The base64encode function returns the base64 encoded input string.
State |
Expression |
Result |
Numeric functions
min(…number)
The min function returns the number with the lowest value.
| State | Expression | Result |
|---|---|---|
|
|
|
max(…number)
The max function returns the number with the highest value.
| State | Expression | Result |
|---|---|---|
|
|
|
round(number, places)
The round function rounds the number to the specified number of places.
The function returns a float.
|
To get rid of the floating point, simply cast to an |
| State | Expression | Result |
|---|---|---|
|
|
|
|
|
|
floor(number)
The floor function rounds the number down to the nearest integer.
| State | Expression | Result |
|---|---|---|
|
|
|
ceil(number)
The ceil function rounds the number up to the nearest integer.
| State | Expression | Result |
|---|---|---|
|
|
|
abs(number)
The abs function returns the absolute value of the provided number.
| State | Expression | Result |
|---|---|---|
|
|
|
|
|
|
log(number)
The log function returns the base 10 logarithm of the given number.
| State | Expression | Result |
|---|---|---|
|
|
|
pow(number, exp)
The pow function returns the number to the power of exp.
|pow |pow(number, number)|The function returns x**y, the base-x exponential of y, see math.Pow|pow(2, 3) results in 8
| State | Expression | Result |
|---|---|---|
|
|
|
sqrt(number)
The sqrt function returns the square root of the given number.
| State | Expression | Result |
|---|---|---|
|
|
|
sum(…number)
The sum function returns the sum of all the provided arguments.
| State | Expression | Result |
|---|---|---|
|
|
|
average(…number)
The average function returns the average from the provided arguments.
| State | Expression | Result |
|---|---|---|
|
|
|
random(a, b?)
The random function returns a random number.
When called with one argument (random(to)) the random number is between 0 and to.
When called with two arguments (random(from, to)) the random number is between from and to.
| State | Expression | Result |
|---|---|---|
|
|
|
|
|
|
int(Any)
The int function casts the argument to Integer.
If the value can not be casted, the function returns 0
|
When you assign a value to a variable it is automatically casted to the specified type. You only need explicit casting when providing arguments. |
| State | Expression | Result |
|---|---|---|
|
|
|
|
|
|
Date and time functions
earliest(DateTime, …DateTime)
|earliest |earliest(arg1, arg2, …argN)|The function returns earliest DateTime.|earliest(datefield1, datefield2) results in "1970-01-01T00:00:00"
The earliest function returns the earliest DateTime.
| State | Expression | Result |
|---|---|---|
|
|
|
latest
The latest function returns the latest DateTime.
| State | Expression | Result |
|---|---|---|
|
|
|
parseISOTime
The parseISOTime function parses the ISO formatted timestamp.
| State | Expression | Result |
|---|---|---|
|
|
|
modTime
The modTime function returns a new DateTime with added duration.
The modTime function interacts with the time part of the DateTime.
Use modDate, modWeek, modMonth, or modYear if you wish to adjust larger components.
| State | Expression | Result |
|---|---|---|
|
|
|
modDate(datetime, days)
The modDate function returns a new DateTime with added days.
The modDate function interacts with the date (days) part of the DateTime.
| State | Expression | Result |
|---|---|---|
|
|
|
modWeek(datetime, weeks)
The modWeek function returns a new DateTime with added weeks.
The modWeek function interacts with the date (days) part of the DateTime.
| State | Expression | Result |
|---|---|---|
|
|
|
modMonth(datetime, months)
The modMonth function returns a new DateTime with added months.
The modMonth function interacts with the month part of the DateTime.
| State | Expression | Result |
|---|---|---|
|
|
|
modYear(datetime, years)
The modYear function returns a new DateTime with added years.
The modYear function interacts with the year part of the DateTime.
| State | Expression | Result |
|---|---|---|
|
|
|
parseDuration
The parseDuration function returns the parsed duration from the given string.
| State | Expression | Result |
|---|---|---|
|
|
|
strftime(datetime, pattern)
The strftime function returns the formatted DateTime based on the given pattern.
Refer to Date and time formatting for more details.
| State | Expression | Result |
|---|---|---|
|
|
|
isLeapYear(datetime)
The isLeapYear function returns true if the given DateTime is a leap year.
| State | Expression | Result |
|---|---|---|
|
|
|
|
|
|
now
The now function returns the current DateTime
| State | Expression | Result |
|---|---|---|
|
|
|
isWeekDay
|isWeekDay |isWeekDay(datetime)|The function returns true if the specified day is week day.|isWeekDay(datefield) results in true
The isWeekDay function returns true if the given DateTime is a week day.
| State | Expression | Result |
|---|---|---|
|
|
|
|
|
|
sub(from, to)
The sub function returns the difference between two DateTime in milliseconds.
The from must be larger then to; if not, the function will error out.
| State | Expression | Result |
|---|---|---|
|
|
|
KV functions
|
The resulting type of the KV function is based on the first argument. You may not provide multiple different KV types (KV, KVV, Vars) into the same function. To exemplify; |
set(kv, k, v)
The set function assigns a value to the given KV-like variable.
The original value remains unchanged.
| State | Expression | Result |
|---|---|---|
|
|
|
merge(kv, …kv)
|merge |merge(KV, arg1, …argN)|The function combines all of the given KV types into a single KV type.|merge(&KVV{"foo": ["foo"]}, &KVV{"bar": ["bar"]}) results in &KVV{"foo": ["foo"], "bar": ["bar"]}, Same for KV and Vars.
The merge function merges all of the KV-like variables into a single KV.
The original value remains unchanged.
| State | Expression | Result |
|---|---|---|
|
|
|
filter(kv, …include)
The filter function returns a new KV including only the specified keys.
The original value remains unchanged.
| State | Expression | Result |
|---|---|---|
|
|
|