RemoveString removes a target string from a string slice if it exists
(strs []string, target string)
| 103 | |
| 104 | // RemoveString removes a target string from a string slice if it exists |
| 105 | func RemoveString(strs []string, target string) []string { |
| 106 | var result []string |
| 107 | for _, item := range strs { |
| 108 | if item == target { |
| 109 | continue |
| 110 | } |
| 111 | result = append(result, item) |
| 112 | } |
| 113 | return result |
| 114 | } |
| 115 | |
| 116 | func HasDuplicateStr(in []string) bool { |
| 117 | keys := strset.New() |
no outgoing calls