StringInSlice checks if a string appears in a slice.
(s string, sl []string)
| 6 | |
| 7 | // StringInSlice checks if a string appears in a slice. |
| 8 | func StringInSlice(s string, sl []string) bool { |
| 9 | for _, v := range sl { |
| 10 | if v == s { |
| 11 | return true |
| 12 | } |
| 13 | } |
| 14 | return false |
| 15 | } |
| 16 | |
| 17 | // CompareStringSlices checks if two slices are equal. |
| 18 | // It returns the number of different items. |
no outgoing calls