publapi/utils/main.go
Odyssey 8acdb78f00 something
Signed-off-by: Odyssey <odyssey346@disroot.org>
2023-01-19 16:08:09 +01:00

27 lines
406 B
Go

package utils
import (
"strings"
)
func Dedup(input string) string {
unique := []string{}
words := strings.Split(input, " ")
for _, word := range words {
if contains(unique, word) {
continue
}
unique = append(unique, word)
}
return strings.Join(unique, " ")
}
func contains(strs []string, str string) bool {
for _, s := range strs {
if s == str {
return true
}
}
return false
}