Golang數組去重&切片去重

方法一: 定義一個新切片(數組),存放原數組的第一個元素,而後將新切片(數組)與原切片(數組)的元素一一對比,若是不一樣則存放在新切片(數組)中。web package main import "fmt" func main() { var arr = []string{"hello", "hi", "world", "hi", "china", "hello", "hi"}
相關文章
相關標籤/搜索