gitlab.com/evatix-go/core@v1.3.55/errcore/StringLinesToQuoteLines.go (about)

     1  package errcore
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"gitlab.com/evatix-go/core/internal/msgformats"
     7  )
     8  
     9  // StringLinesToQuoteLines
    10  //
    11  // Each line will be wrapped with "\"%s\", quotation and comma
    12  func StringLinesToQuoteLines(lines []string) []string {
    13  	if len(lines) == 0 {
    14  		return []string{}
    15  	}
    16  
    17  	slice := make(
    18  		[]string,
    19  		len(lines))
    20  
    21  	for i, line := range lines {
    22  		slice[i] = fmt.Sprintf(
    23  			msgformats.LinePrinterFormat,
    24  			line)
    25  	}
    26  
    27  	return slice
    28  }