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

     1  package stringslice
     2  
     3  // LinesSimpleProcess split text using constants.NewLineUnix
     4  // then returns lines processed by lineProcessor
     5  func LinesSimpleProcess(
     6  	splitsLines []string,
     7  	lineProcessor func(lineIn string) (lineOut string),
     8  ) []string {
     9  	length := len(splitsLines)
    10  
    11  	if length == 0 {
    12  		return []string{}
    13  	}
    14  
    15  	slice := Make(length, length)
    16  
    17  	for i, lineIn := range splitsLines {
    18  		lineOut := lineProcessor(lineIn)
    19  
    20  		slice[i] = lineOut
    21  	}
    22  
    23  	return slice
    24  }