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

     1  package stringslice
     2  
     3  import "gitlab.com/evatix-go/core/constants"
     4  
     5  func LastOrDefaultPtr(slice *[]string) string {
     6  	if slice == nil {
     7  		return constants.EmptyString
     8  	}
     9  
    10  	length := len(*slice)
    11  
    12  	if length == 0 {
    13  		return constants.EmptyString
    14  	}
    15  
    16  	return (*slice)[length-constants.One]
    17  }