我想创建一个包含唯一字符串的数组。我怎样才能做到这一点?
var paths = make([]string, 0)
func main() {
// Members are added dynamically
paths = append(paths, "aaa")
paths = append(paths, "bbb")
paths = append(paths, "bbb")
paths = append(paths, "ccc")
// convert ["aaa", "bbb", "bbb", "ccc"] -> ["aaa", "bbb", "ccc"]
// or can I use some class that disallow the same string automaticaly?
}
湖上湖
相关分类