gitlab.com/evatix-go/core@v1.3.55/coreimpl/enumimpl/PrependJoin.go (about)

     1  package enumimpl
     2  
     3  import (
     4  	"fmt"
     5  	"strings"
     6  
     7  	"gitlab.com/evatix-go/core/constants"
     8  )
     9  
    10  func PrependJoin(
    11  	joiner string,
    12  	prepend interface{},
    13  	anyItems ...interface{},
    14  ) string {
    15  	slice := make([]string, len(anyItems)+constants.Capacity1)
    16  	slice[constants.Zero] = fmt.Sprintf(constants.SprintValueFormat, prepend)
    17  
    18  	for i, item := range anyItems {
    19  		slice[i+1] = fmt.Sprintf(
    20  			constants.SprintValueFormat,
    21  			item)
    22  	}
    23  
    24  	return strings.Join(slice, joiner)
    25  }