gitlab.com/evatix-go/core@v1.3.55/simplewrap/DoubleQuoteWrapElementsWithIndexes.go (about) 1 package simplewrap 2 3 import ( 4 "strconv" 5 6 "gitlab.com/evatix-go/core/constants" 7 ) 8 9 // DoubleQuoteWrapElementsWithIndexes Returns new empty slice if nil or empty slice given. 10 func DoubleQuoteWrapElementsWithIndexes( 11 inputElements ...string, 12 ) (doubleQuoteWrappedItems []string) { 13 if inputElements == nil { 14 return []string{} 15 } 16 17 length := len(inputElements) 18 newSlice := make([]string, length) 19 20 if length == 0 { 21 return newSlice 22 } 23 24 for i, item := range inputElements { 25 indexString := constants.SquareStart + 26 strconv.Itoa(i) + 27 constants.SquareEnd 28 29 newSlice[i] = WithDoubleQuote( 30 item + indexString) 31 } 32 33 return newSlice 34 }