Home / Go / slice tricks edit
Try Documentalist, my app that offers fast, offline access to 190+ programmer API docs.

AppendVector: a = append(a, b...)

Copy: b = make([]T, len(a))
copy(b, a)

Cut: a = append(a[:i], a[j:]...)

Delete: a = append(a[:i], a[i+1:]...)
// or
a = a[:i+copy(a[i:], a[i+1:])]

Delete without preserving order: a[i], a = a[len(a)-1], a[:len(a)-1]

github.com/bradfitz/slice
func Sort(slice interface{}, less func(i, j int) bool)

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:

Share on        

Need fast, offline access to 190+ programmer API docs? Try my app Documentalist for Windows