Browse Source

StringInSlice ist doppelt ;-(

master
Klaus Wendel 1 year ago
parent
commit
a438bb7325
  1. 40
      ebkTools.go

40
ebkTools.go

@ -146,6 +146,26 @@ func InSlice(slice interface{}, value interface{}) (exists bool, index int) {
return
}
//Check if string is inside slice
func StringInSlice(list *[]string, a string) bool {
for _, b := range *list {
if b == a {
return true
}
}
return false
}
// Contains tells whether a contains x.
func SliceContainsString(haystack []string, needle string) int {
for i, v := range haystack {
if needle == v {
return i
}
}
return -1
}
// All Values in Array are equal
func CheckSliceEquility(myslice interface{}) bool {
if reflect.ValueOf(myslice).Len() > 1 {
@ -181,16 +201,6 @@ func StringsDiff(a, b []string) (diff []string) {
return
}
//Check if sting is inside slice
func StringInSlice(list *[]string, a string) bool {
for _, b := range *list {
if b == a {
return true
}
}
return false
}
func GeneratorUmlaufListe(start, ende, einsprung int) (umlaufliste []int) {
for i := einsprung; i <= ende; i++ {
umlaufliste = append(umlaufliste, i)
@ -201,16 +211,6 @@ func GeneratorUmlaufListe(start, ende, einsprung int) (umlaufliste []int) {
return
}
// Contains tells whether a contains x.
func SliceContainsString(haystack []string, needle string) int {
for i, v := range haystack {
if needle == v {
return i
}
}
return -1
}
// Dank an https://programming.guide/go/formatting-byte-size-to-human-readable-format.html
func ByteCountDecimal(b int64) string {
const unit = 1024

Loading…
Cancel
Save