gitlab.com/evatix-go/core@v1.3.55/simplewrap/wrapDoubleQuoteOnNonExist.go (about) 1 package simplewrap 2 3 import "gitlab.com/evatix-go/core/constants" 4 5 func wrapDoubleQuoteByExistenceCheck( 6 inputSlice []string, 7 newSlice []string, 8 ) []string { 9 for i, item := range inputSlice { 10 itemLength := len(item) 11 if itemLength < 2 { 12 newSlice[i] = WithDoubleQuote(item) 13 14 continue 15 } 16 17 // more than 2 char 18 if item[0] == constants.DoubleQuoteChar && item[itemLength-1] == constants.DoubleQuoteChar { 19 continue 20 } 21 22 // quote not there or one is there. 23 newSlice[i] = WithDoubleQuote(item) 24 } 25 26 return newSlice 27 }