Swift中数组如何像OC中一样取subarrayWithRange获得子数组呢?
let a = [1,2,3,4,5,6] let b = a[2...5] //b = [3,4,5,6]
如上
上面獲得的是ArraySlice 需要再用Array來包一層
let a = [1,2,3,4,5,6] let b = a[0...1] //b is type of ArraySlice let b= Array(a[0...1]) //b is array
如上
上面獲得的是ArraySlice 需要再用Array來包一層