Delete an array column, and change position of two columns

前端 未结 3 1702
醉话见心
醉话见心 2021-01-16 02:23

So let\'s say i have and 4x4 array of various numbers.

I want to delete the third array column, and switch positions of the second and fourth columns within the array

3条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-16 03:16

    The best way to deal with this issue is to use a better structure than an array. E.g a dictionary of arrays (Collection, Scripting.Dictionary, Arraylist, jagged array). So instead of reading a two dimensional section of a spreadsheet into an array, iterate over the columns and add each column as an array to a dictionary. You can then set up a second simpler dictionary to map each current index to its new index. No need to delete anything as you will only copy back, column array by column array, those columns you actually need.

提交回复
热议问题