MCPcopy Create free account
hub / github.com/OpenAtomFoundation/SmartIDE / RemoveEmptyItem

Function RemoveEmptyItem

cli/pkg/common/array.go:57–72  ·  view source on GitHub ↗

剔除空元素

(slice []string)

Source from the content-addressed store, hash-verified

55
56// 剔除空元素
57func RemoveEmptyItem(slice []string) []string {
58 if len(slice) == 0 {
59 return slice
60 }
61 for i, v := range slice {
62 if strings.TrimSpace(v) == "" {
63 if i+1 > len(slice) {
64 slice = slice[:i]
65 } else {
66 slice = append(slice[:i], slice[i+1:]...)
67 }
68 return RemoveEmptyItem(slice)
69 }
70 }
71 return slice
72}
73
74// 剔除空元素
75func RemoveItem(slice []string, item string) []string {

Callers 1

CheckLocalEnvFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected