gitlab.com/evatix-go/core@v1.3.55/coreutils/stringutil/MaskTrimLines.go (about) 1 package stringutil 2 3 import "strings" 4 5 func MaskTrimLines( 6 mask string, 7 lines ...string, 8 ) []string { 9 length := len(lines) 10 slice := make([]string, length) 11 12 if length == 0 { 13 return slice 14 } 15 16 for i, line := range lines { 17 line2 := strings.TrimSpace(line) 18 19 if len(line2) > len(mask) || len(mask) == 0 { 20 slice[i] = line2 21 22 continue 23 } 24 25 slice[i] = line2 + mask[len(line2):] 26 } 27 28 return slice 29 }