Safer string compare

master
Uriel Fanelli 2023-08-14 19:54:24 +02:00
parent 0e5f76f9bd
commit 9b5443b341
1 changed files with 2 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import (
"fmt" "fmt"
"log" "log"
"slices" "slices"
"strings"
"time" "time"
) )
@ -30,7 +31,7 @@ func (mip *AbstractMulticast) IsAlpha(hier string) bool {
alpha := mip.HierarchyArray[indexMax] alpha := mip.HierarchyArray[indexMax]
log.Println("Maximum element is :", alpha) log.Println("Maximum element is :", alpha)
log.Println("Array is :", mip.HierarchyArray) log.Println("Array is :", mip.HierarchyArray)
return alpha == hier return strings.Compare(alpha, hier) == 0
} }