package diff
import (
"strings"
)
// TrimLines applies TrimSpace to each string in the given array.
func TrimLines(input []string) []string {
result := make([]string, 0, len(input))
for _, el := range input {
result = append(result, strings.TrimSpace(el))
}
return result
}
// TrimLinesInString applies TrimSpace to each line in the given string, and returns the new trimmed string. Empty lines are not removed.
func TrimLinesInString(input string) string {
return strings.Join(TrimLines(strings.Split(strings.TrimSpace(input), "\n")), "\n")
}
|
The pages are generated with Golds v0.3.2. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |