GitHubContribute in GitHub: Edit online

array_shift_left()

Shifts the values inside a dynamic array to the left.

Syntax

array_shift_left(array, shift_count [, fill_value ])

Arguments

  • array: Input array to shift, must be dynamic array.
  • shift_count: Integer specifying the number of positions that array elements will be shifted to the left. If the value is negative, the elements will be shifted to the right.
  • fill_value: Scalar value that is used for inserting elements instead of the ones that were shifted and removed. Default: null value or empty string (depending on the array type).

Returns

Dynamic array containing the same number of elements as in the original array. Each element has been shifted according to shift_count. New elements that are added in place of removed elements will have a value of fill_value.

See also

Examples

  • Shifting to the right by two positions by using negative shift_count value:

    print arr=dynamic([1,2,3,4,5]) 
    | extend arr_shift=array_shift_left(arr, -2, -1)
    

    Results

    arr arr_shift
    [1,2.3,4.5] [-1,-1,1,2,3]