so if I now shift it again with the same commands, it just moves those three below the first sunday, aka moving the first sunday back to the top of the list.
is there something I have to do after a shift to make the array ‘normal’ again, so that $array[0] is just the first line of the array?
What is it what you actually try to do in the end? Arrays are actually immutable. With the operator += you actually use the “old” array and a new element to create a “new” array with the content of the old plus the new element. If you need more felxibility you should use arraylists.
You might change your line of code from this
Thanks guys. The notifications for your replies went to my junk folder, and I’ve since solved my issue by creating a Monday to Sunday enum and sorting my array by it.
PowerShell uses Sunday as the first day of the week day zero, so sorting by the [int] [dayofweek] value wasn’t working for me. I needed Monday to be first. I tried shifting Sundays to the end with a do/while loop, but ran into the issue in the original post.
@Russell yep, but then I was told actually didn’t even need the “= [integer]” part if the enum lists the days in the order I wanted. It will automatically assign an index value based on the order