Back to FabImage Studio website

You are here: Start » Filter Reference » Array » Array Transforms » RotateArray

RotateArray


Module: FoundationLite

Cyclically shifts the elements of an array.

Name Type Description
Input value inArray <T>Array Input array
Input value inShift Integer Input the number of positions each element should be shifted by
Input value inInverse Bool Determines if the indices are counted from beginning or from end of the input array
Output value outArray <T>Array Cyclically shifted array

The type of this filter is defined using the type variable T which represents any valid type. Read more.

Description

The operation moves each of the inArray elements forward by inShift positions. Whenever the resulting index exceeds the size of the array, it cycles back to the beginning of the array.

Examples

inArray = {1,2,3,4,5,6,7}
inShift = 2
outArray = {6,7,1,2,3,4,5}

Complexity Level

This filter is available on Advanced Complexity Level.

See Also

  • SlideArray – Creates two copies of the input array - one with elements removed at the beginning, the other with elements removed at the end.
  • ReverseArray – Creates an array of the input array elements in reversed order.