gitlab.com/evatix-go/core@v1.3.55/coredata/stringslice/SafeIndexAtWith.go (about) 1 package stringslice 2 3 func SafeIndexAtWith( 4 slice []string, 5 index int, 6 defaultVal string, 7 ) string { 8 if len(slice) == 0 || index < 0 || len(slice)-1 < index { 9 return defaultVal 10 } 11 12 return slice[index] 13 }