This is a new site that's currently running on alpha code. There are going to be bugs. If you discover any, please report them on the site's issues page (GitHub account required). Thanks.
Warning: Many URLs are going to change. Refer to the README file to discover which library project's documentation has been completed.
Project: Array Utilities Unit
Unit: DelphiDabbler.Lib.ArrayUtils
Applies to: ~>0.1
TArrayUtils is an advanced record that provides a container for numerous static generic methods that perform useful operations on arrays.
TArrayUtils contains no data and should never be instantiated.
TArrayUtils defines numerous static class methods. All methods are generic.
Method | Description |
---|---|
Chop<T> | Removes a range of elements from an array and returns those elements. |
Compare<T> | Compares two arrays. |
Concat<T> | Concatenates two arrays. |
Contains<T> | Checks if an element is contained in an array. |
Copy<T> | Returns a copy of an array. |
CopyReversed<T> | Returns a reversed copy of an array. |
CopySorted<T> | Returns a sorted copy of an array. |
DeDup<T> | Returns a copy of an array with no duplicated elements. |
Delete<T> | Deletes one or more elements from an array. |
DeleteAndFree<T:class> | Deletes and frees one or more elements from an array of objects. |
DeleteAndFreeRange<T:class> | Deletes and frees a range of elements from an array of objects. |
DeleteAndRelease<T> | Deletes one or more elements from an array and releases any resources associated with the deleted elements. |
DeleteAndReleaseRange<T> | Deletes a range of elements from an array and releases any resources associated with the deleted elements. |
DeleteRange<T> | Deletes a range of elements from an array. |
Equal<T> | Checks if two arrays are equal. |
EqualStart<T> | Checks if a specified number of elements at the start of an array are equal. |
Every<T> | Checks if all elements of an array satisfy given criteria. |
FindAll<T> | Finds all the elements in an array that satisfy given criteria. |
FindAllIndices<T> | Finds the indices of all the elements in an array that satisfy given criteria. |
FindDef<T> | Finds the first element in an array that satisfies given criteria or returns a default value if there is no matching value. |
FindIndex<T> | Finds the index of the first element in an array that satisfies given criteria. |
FindLastDef<T> | Finds the last element in an array that satisfies given criteria or a returns default value if there is no matching value. |
FindLastIndex<T> | Finds the index of the last element in an array that satisfies given criteria. |
First<T> | Returns the first element of an array. |
ForEach<T> | Calls a given procedure for every element of an array. |
IndexOf<T> | Returns the first index of an element in an array that is equal to a given value. |
IndicesOf<T> | Returns an array of indices of all elements of an array that are equal to a given value. |
Insert<T> | Inserts an element into an array at a given index. |
Last<T> | Returns the last element of an array. |
LastIndexOf<T> | Returns the last index of an element in an array that is equal to a given value. |
Max<T> | Finds the maximum value of all elements in an array. |
Min<T> | Finds the minimum value of all elements in an array. |
MinMax<T> | Finds the minimum and maximum values of all elements in an array. |
OccurrencesOf<T> | Counts the number of occurrences of an element in an array. |
Pick<T> | Returns the elements at selected indices in an array. |
Pop<T> | Removes and returns the last element of an array. |
PopAndFree<T:class> | Removes and frees the last element of an array of objects. |
PopAndRelease<T> | Removes the last element of an array and releases any resource associated with the removed element. |
Push<T> | Adds a given element to the end of an array. |
Reduce<T> | Reduces the elements of an array to a single value that has the same type as the array elements. |
Reduce<TIn,Tout> | Reduces the elements of an array to a single value that has a different type to that of the array elements. |
Reverse<T> | Reverses the order of elements in an array. |
Shift<T> | Removes and returns the first element of an array. |
ShiftAndFree<T:class> | Removes and frees the first element of an array of objects. |
ShiftAndRelease<T> | Removes the last element of an array and releases any resource associated with the removed element. |
Slice<T> | Returns a contiguous range of elements of an array. |
Some<T> | Checks if at least one element of an array satisfies given criteria. |
Sort<T> | Sorts an array. |
Transform<TIn,TOut> | Transforms an array with elements of one type into another array with elements of an optionally different type. |
TryFind<T> | Attempts to find the first element in an array that satisfies given criteria. |
TryFindLast<T> | Attempts to find the last element in an array that satisfies given criteria. |
UnShift<T> | Inserts an element at the start of an array. |
Several inner types are defined. All define callbacks.
The usage of these functions and procedures is explained on the pages relating to the TArrayUtils methods that use them.
Type | Description |
---|---|
TCallback<T> and TCallbackEx<T> | Reference to a procedure called iteratively by different overloaded versions of the ForEach<T> method. Procedures of type TCallback<T> are also called by methods that release a resource associated with array elements. |
TCloner<T> | Reference to a function that creates a deep copy of a given value. Called iteratively by the overloaded version of the Copy<T> method that makes a deep copy of an array. |
TConstraint<T> and TConstraintEx<T> | References to predicate functions that are called iteratively by various methods when searching or testing the elements of an array. |
TReducer<T> and TReducerEx<T> | Reference to a function called iteratively by different overloaded versions of the Reduce<T> method. |
TReducer<TIn,TOut> and TReducerEx<TIn,TOut> | Reference to a function called iteratively by different overloaded versions of the Reduce<TIn,TOut> method. |
TTransformer<TIn,TOut> and TTransformerEx<TIn,TOut> | References to functions called iteratively by different overloaded versions of the Transform<TIn,TOut> method. |