码迷,mamicode.com
首页 > 其他好文 > 详细

golang中删除切片中的元素

时间:2019-08-23 19:33:28      阅读:195      评论:0      收藏:0      [点我收藏+]

标签:UNC   ola   ring   fun   main   end   切片   class   str   

func main() {
    a := []string{"Hello1", "Hello2", "Hello3"}
    fmt.Println(a)  // [Hello1 Hello2 Hello3]
    
    a = append(a[:0], a[1:]...)
    fmt.Println(a)  // [Hello2 Hello3]
}

golang中删除切片中的元素

标签:UNC   ola   ring   fun   main   end   切片   class   str   

原文地址:https://www.cnblogs.com/shuchengyi/p/11401838.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!