28 lines
460 B
Go
28 lines
460 B
Go
package outbound
|
|
|
|
import (
|
|
"sort"
|
|
"strings"
|
|
)
|
|
|
|
func uniqueStrings(list []string) []string {
|
|
if len(list) == 0 {
|
|
return nil
|
|
}
|
|
seen := make(map[string]struct{}, len(list))
|
|
result := make([]string, 0, len(list))
|
|
for _, item := range list {
|
|
item = strings.TrimSpace(item)
|
|
if item == "" {
|
|
continue
|
|
}
|
|
if _, ok := seen[item]; ok {
|
|
continue
|
|
}
|
|
seen[item] = struct{}{}
|
|
result = append(result, item)
|
|
}
|
|
sort.Strings(result)
|
|
return result
|
|
}
|