What is the idiomatic way to slice an array relative to both of its ends?

前端 未结 7 1430
梦如初夏
梦如初夏 2021-02-06 20:35

Powershell\'s array notation has rather bizarre, albeit documented, behavior for slicing the end of arrays. This section from the official documentation sums up the bizarreness

7条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-06 21:29

    Although not as neat as you might want but is cleaner in the way PowerShell works ...

    (@(1,2,3,4)) | Select-Object -Skip 1
    

    returns ...

    2
    3
    4
    

提交回复
热议问题