gitlab.com/evatix-go/core@v1.3.55/corecmp/IsStringsEqualWithoutOrder.go (about) 1 package corecmp 2 3 import "sort" 4 5 // IsStringsEqualWithoutOrder 6 // 7 // Sort then compare 8 func IsStringsEqualWithoutOrder(leftItems, rightItems []string) bool { 9 if leftItems == nil && rightItems == nil { 10 return true 11 } 12 13 if leftItems == nil || rightItems == nil { 14 return false 15 } 16 17 length := len(leftItems) 18 if length != len(rightItems) { 19 return false 20 } 21 22 sort.Strings(leftItems) 23 sort.Strings(rightItems) 24 25 for i := 0; i < length; i++ { 26 if leftItems[i] != rightItems[i] { 27 return false 28 } 29 } 30 31 return true 32 }