2020
12-22
12-22
golang将切片或数组根据某个字段进行分组操作
我就废话不多说了,大家还是直接看代码吧~packagemainimport("fmt""sort")typePersonstruct{NamestringAgeint}funcmain(){p1:=Person{"Tom",20}p2:=Person{"Lily",21}p3:=Person{"Linda",23}p4:=Person{"Jass",25}p5:=Person{"Tonny",20}p6:=Person{"Pite",25}p7:=Person{"Paul",21}p8:=Person{"Kriss",27}p9:=Person{"Jake",23}p10:=Person{"Rose",20}personList:=[]Person{}per...
继续阅读 >