Array Functions

Function Description
add(array,element) Returns a new array that includes the original array plus the newly added element at the end.
Parameters:
    array: The array to which the element is to be added.
    element: One or more elements to be added, or an array of elements. This is a varargs parameter, allowing for multiple elements to be listed.
Examples:
    add(states, “Texas”) - Creates a new array with all elements of states plus “Texas” at the end.
    add(states, “California”, “Nevada”, “Oregon”) - Creates a new array with all elements of states plus “California”, “Nevada”, and “Oregon” added at the end.
    add(states, newStates) - Creates a new array with all elements of states plus all elements of newStates added at the end.
add(array1, array2, …, arrayN) Adds all elements of the provided arrays into a new array.
addAll(array1, array2) Adds all elements of the given arrays into a new array.
addElement(array, index, element) Returns a new array that includes a specific element inserted at a given index within the original array.
Parameters:
    array: The array into which the elements to be inserted.
    index: The position in the array where the new elements must be inserted. This index starts at zero.
    element: One or more elements to be inserted, or an array of elements. This is a varargs parameter, allowing for multiple elements to be listed.
Examples:
    addElement(states, 3, “Texas”) - Creates a new array with all elements of states plus “Texas” at the 4th position in the states array.
    addElement(states, 2, “California”, “Nevada”, “Oregon”) - Creates a new array with all elements of states plus “California”, “Nevada”, and “Oregon” starting at the 3rd position in the states array.
    addElement(states, 1, newStates) - Creates a new array with all elements of states plus all elements of newStates array starting at the 2nd position in the states array.
allFalse(Boolean[]) Returns true if all array elements are false.
anyFalse(Boolean[]) Returns true if any array element is false.
allTrue(Boolean[]) Returns true if all array elements are true.
anyTrue(Boolean[]) Returns true if any array element is true.
avg(array) Returns the arithmetic average of the array of number elements.
big(array, int position) Removes null values from array, sorts an array in descending order and returns the value at position ‘position’.
concatenate(array) Joins several values in one text string.
contains(array, elem) Checks if the value is in the given array.
Instead of an array, this function can accept a range or an array of ranges.
indexOf(array[], elem) Finds the index of the given value in the array.
intersection(String[] array1, String[] array2) Returns a new array containing elements common to the two arrays.
isEmpty(array) Checks if an array is empty or null.
flatten(arrayN) Returns a flatten array with values from arrayN. Returns a single dimension array of elements. Converts a matrix into a list.
length(array) Returns the number of elements in the array. It is more preferable than the array.length syntax.
max(array) Returns the maximal value in the array of numbers.
median(array) Returns the middle number in a group of supplied numbers. For example, =MEDIAN(1,2,3,4,5) returns 3.
The result is a floating value.
min(array) Returns the minimal value in the array of numbers.
noNulls(array) Checks if the array is non-empty and has only non-empty elements.
product(array values) Multiplies the numbers from the provided array and returns the product as a number.
remove(array, int index) Removes the element at the specified position from the specified array.
removeElement(array, element) Removes the first occurrence of the specified element from the specified array.
removeNulls(T[] array) Returns a new array without null elements.
slice(array, int startIndexInclusive,
int endIndexExclusive)
Returns a part of the array from startIndexInclusive to endIndexExclusive.
small(array, int position) Removes null values from array, sorts an array in ascending order and returns the value at position ‘position’.
sort(array) Sorts the specified array of values into ascending order, according to the natural ordering of its elements.
sum(array) Returns the sum of numbers in the array.