Array manipulation.
More...
|
| value | Create (integer size, value initialValue) |
| | Creates an array.
|
| integer | Length (array array) |
| | Gets the length of an array.
|
| void | Push (array array, value value) |
| | Adds a value to the end of an array.
|
| value | Pop (array array) |
| | Gets the value at the end of an array, and removes it.
|
| void | Insert (array array, integer index, value value) |
| | Inserts a value at an index of an array.
|
| void | Erase (array array, integer index) |
| | Erases a value at an index of an array.
|
| void | Clear (array array) |
| | Clears an array.
|
| void | Shift (array array, boolean toRight) |
| | Rotates the array in the desired direction.
|
| void | SetAll (array array, integer startIndex, integer endIndex, value value) |
| | Sets values in the array from startIndex to endIndex (includes the value at endIndex.).
|
| void | Reverse (array array, integer startIndex=0, integer endIndex) |
| | Reverses the elements of an array through the specified range, exclusive. The array is reversed from startIndex to, but not including, endIndex.
|
| void | Sort (array array, function compFunction) |
| | Sorts the entries of the given array.
|
◆ Clear()
| void Array.Clear |
( |
array | array | ) |
|
Clears an array.
- Parameters
-
◆ Create()
| value Array.Create |
( |
integer | size, |
|
|
value | initialValue ) |
Creates an array.
- Parameters
-
| size | Size of the array. |
| initialValue | Initial value to set the array elements to. |
- Returns
- A reference value to the array.
◆ Erase()
| void Array.Erase |
( |
array | array, |
|
|
integer | index ) |
Erases a value at an index of an array.
- Parameters
-
| array | Array to erase value. |
| index | Index to erase value. |
◆ Insert()
| void Array.Insert |
( |
array | array, |
|
|
integer | index, |
|
|
value | value ) |
Inserts a value at an index of an array.
- Parameters
-
| array | Array to insert value. |
| index | Index to insert value. |
| value | Value to insert. |
◆ Length()
| integer Array.Length |
( |
array | array | ) |
|
Gets the length of an array.
- Parameters
-
| array | Array to get the length of. |
- Returns
- Length of the array.
◆ Pop()
| value Array.Pop |
( |
array | array | ) |
|
Gets the value at the end of an array, and removes it.
- Parameters
-
| array | Array to get the length of. |
- Returns
- The value from the end of the array.
◆ Push()
| void Array.Push |
( |
array | array, |
|
|
value | value ) |
Adds a value to the end of an array.
- Parameters
-
| array | Array to get the length of. |
| value | Value to add to the array. |
◆ Reverse()
| void Array.Reverse |
( |
array | array, |
|
|
integer | startIndex = 0, |
|
|
integer | endIndex ) |
Reverses the elements of an array through the specified range, exclusive. The array is reversed from startIndex to, but not including, endIndex.
- Parameters
-
| array | Array to reverse. |
| startIndex | Start range. |
| endIndex | End range. (default: size of array) |
◆ SetAll()
| void Array.SetAll |
( |
array | array, |
|
|
integer | startIndex, |
|
|
integer | endIndex, |
|
|
value | value ) |
Sets values in the array from startIndex to endIndex (includes the value at endIndex.).
- Parameters
-
| array | Array to set values to. |
| startIndex | Index of value to start setting. (-1 for first index) |
| endIndex | Index of value to end setting. (-1 for last index) |
| value | Value to set to. |
◆ Shift()
| void Array.Shift |
( |
array | array, |
|
|
boolean | toRight ) |
Rotates the array in the desired direction.
- Parameters
-
| array | Array to shift. |
| toRight | Whether to rotate the array to the right or not. |
◆ Sort()
| void Array.Sort |
( |
array | array, |
|
|
function | compFunction ) |
Sorts the entries of the given array.
- Parameters
-
| array | Array to sort. |
| compFunction | Comparison function. If not given, a default comparison function is used; the entries of the array are sorted in ascending order, and non-numeric values do not participate in the comparison. |