Skip to content

Commit 4d62cc4

Browse files
committed
add inSlice
1 parent e8d5090 commit 4d62cc4

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

util/slice.go

+9
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,12 @@ func SliceIntToString(s []int) []string {
3131
}
3232
return r
3333
}
34+
35+
func InSliceString(needle string, stack []string) bool {
36+
for _, item := range stack {
37+
if needle == item {
38+
return true
39+
}
40+
}
41+
return false
42+
}

0 commit comments

Comments
 (0)