Iterate through slice and remove certain string, then return cleaned slice
(slice []string, s string)
| 154 | |
| 155 | // Iterate through slice and remove certain string, then return cleaned slice |
| 156 | func RemoveString(slice []string, s string) (result []string) { |
| 157 | for _, item := range slice { |
| 158 | if item == s { |
| 159 | continue |
| 160 | } |
| 161 | result = append(result, item) |
| 162 | } |
| 163 | return result |
| 164 | } |
| 165 | |
| 166 | // SliceReplaceElement |
| 167 | func StringSliceReplaceElement(s []string, a, b string) (result []string) { |
no outgoing calls