Browse Source

SliceIntUnique

master
Klaus Wendel 7 months ago
parent
commit
ddffefff9c
  1. 13
      ebkTools.go

13
ebkTools.go

@ -215,6 +215,19 @@ func StringsDiff(a, b []string) (diff []string) {
return
}
//https://www.golangprograms.com/remove-duplicate-values-from-slice.html
func SliceIntUnique(intSlice []int) []int {
keys := make(map[int]bool)
list := []int{}
for _, entry := range intSlice {
if _, value := keys[entry]; !value {
keys[entry] = true
list = append(list, entry)
}
}
return list
}
func GeneratorUmlaufListe(start, ende, einsprung int) (umlaufliste []int) {
for i := einsprung; i <= ende; i++ {
umlaufliste = append(umlaufliste, i)

Loading…
Cancel
Save