diff --git a/ebkTools.go b/ebkTools.go index c242263..f0e96a6 100755 --- a/ebkTools.go +++ b/ebkTools.go @@ -140,6 +140,17 @@ func InArray(array interface{}, value interface{}) (exists bool, index int) { return } +// All Values in Array are equal +func CheckSliceEquility(myslice interface{}) bool { + if reflect.ValueOf(myslice).Len() > 1 { + return reflect.DeepEqual( + reflect.ValueOf(myslice).Slice(1, reflect.ValueOf(myslice).Len()).Interface(), + reflect.ValueOf(myslice).Slice(0, reflect.ValueOf(myslice).Len()-1).Interface()) + } else { + return true // One single value is always equal to itself + } +} + // Check error code func Check(e error) { if e != nil {