How to copy end of the Array in swift?

后端 未结 6 1740
感动是毒
感动是毒 2020-11-30 15:20

There must be some really elegant way of copying end of the Array using Swift starting from some index, but I just could not find it, so I ended with this:

f         


        
6条回答
  •  星月不相逢
    2020-11-30 16:06

    You can subscript an open ended range now. This will include elements starting at index 5.

    Swift 4.2

    array[5...]
    

提交回复
热议问题