求助啊 关于2,3,4,5过滤问题求助

hellsam · · 814 次点击
估计是笔试题现场的紧急召唤
#2
更多评论
建议你重新组织一下语言,先把问题理顺了再提问,不然真不好看明白你要干嘛
#1
```` package main import ( "fmt" "strings" ) func main() { form := "2,4,6,70" sql := "2,4,6,9" hash := make(map[string]bool) formsz := strings.Split(form, ",") for _, f := range formsz { hash[f] = true } sqlsz := strings.Split(sql, ",") re := "" for _, s := range sqlsz { if _, ok := hash[s]; !ok { if re != "" { re += "," } re += s } } fmt.Println(re) } ````
#3