Files
go-boilerplate/back/general.go
T

14 lines
269 B
Go

package back
import "slices"
// RemoveTrailingEmptyStrings removes empty strings from the end of a slice.
func RemoveTrailingEmptyStrings(slice []string) []string {
for i, s := range slices.Backward(slice) {
if s != "" {
return slice[:i+1]
}
}
return nil
}