gitlab.com/evatix-go/core@v1.3.55/coredata/stringslice/SafeIndexAtWithPtr.go (about)

     1  package stringslice
     2  
     3  func SafeIndexAtWithPtr(
     4  	slice *[]string,
     5  	index int,
     6  	defaultVal string,
     7  ) string {
     8  	if IsEmptyPtr(slice) || index < 0 || len(*slice)-1 < index {
     9  		return defaultVal
    10  	}
    11  
    12  	return (*slice)[index]
    13  }