gitlab.com/evatix-go/core@v1.3.55/coreutils/stringutil/MaskLines.go (about)

     1  package stringutil
     2  
     3  func MaskLines(
     4  	mask string,
     5  	lines ...string,
     6  ) []string {
     7  	length := len(lines)
     8  	slice := make([]string, length)
     9  
    10  	if length == 0 {
    11  		return slice
    12  	}
    13  
    14  	for i, line := range lines {
    15  		if len(line) > len(mask) || len(mask) == 0 {
    16  			slice[i] = line
    17  
    18  			continue
    19  		}
    20  
    21  		slice[i] = line + mask[len(line):]
    22  	}
    23  
    24  	return slice
    25  }