This commit is contained in:
Mike Schwörer 2023-05-24 21:32:00 +02:00
parent b196adffc7
commit 0652bf22dc
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF

View File

@ -61,3 +61,43 @@ func CompareArr[T OrderedConstraint](arr1 []T, arr2 []T) bool {
return false return false
} }
func CompareString(a, b string) int {
if a == b {
return 0
}
if a < b {
return -1
}
return +1
}
func CompareInt(a, b int) int {
if a == b {
return 0
}
if a < b {
return -1
}
return +1
}
func CompareInt64(a, b int64) int {
if a == b {
return 0
}
if a < b {
return -1
}
return +1
}
func Compare[T OrderedConstraint](a, b T) int {
if a == b {
return 0
}
if a < b {
return -1
}
return +1
}