golang append

1) Append a slice b to an existing slice a: a = append(a,b...)
2) Copy a slice a to a new slice b: b = make([]T,len(a))
copy(b,a)
3) Delete item at index i: a = append(a[:i],a[i+1:]...)
4) Cut from index i till j out of slice a: a = append(a[:i],a[j:]...)
5) Extend slice a with a new slice of length j: a = append(a,make([]T,j)...)
6) Insert item x at index i: a = append(a[:i],append([]T{x},a[i:]...)...)
7) Insert a new slice of length j at index i: a = append(a[:i],append(make([]T,j),a[i:]...)...)
8) Insert an existing slice b at index i: a = append(a[:i],append(b,a[i:]...)...)
9) Pop highest element from stack: x,a = a[len(a)-1],a[:len(a)-1]
10) Push an element x on a stack: a = append(a,x)

相关文章

类型转换 1、int转string 2、string转int 3、string转float ...
package main import s "strings" import...
类使用:实现一个people中有一个sayhi的方法调用功能,代码如...
html代码: beego代码:
1、读取文件信息: 2、读取文件夹下的所有文件: 3、写入文件...
配置环境:Windows7+推荐IDE:LiteIDEGO下载地址:http:...