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

     1  package stringslice
     2  
     3  import "gitlab.com/evatix-go/core/constants"
     4  
     5  func SafeIndexAtUsingLastIndexPtr(
     6  	slice *[]string,
     7  	lastIndex,
     8  	index int,
     9  ) string {
    10  	if lastIndex == 0 || lastIndex < 0 || lastIndex < index || index < 0 {
    11  		return constants.EmptyString
    12  	}
    13  
    14  	return (*slice)[index]
    15  }