Go 切片

winnie123321 · · 1146 次点击
```go a = append(a[:i], a[i+1:]...) // or a = a[:i+copy(a[i:], a[i+1:])] ``` https://github.com/golang/go/wiki/SliceTricks
#1
更多评论
我定义了一个切片, 如何删除元素3 ?? a := []int{1, 2, 3, 4, 5}
#2
```go index := 3 b := append(a[:index-1], a[index:]...) fmt.Println(b) ```
#3