publapi/utils/main.go
2024-09-28 20:50:57 +02:00

31 lines
474 B
Go

package utils
import (
_ "embed"
"strings"
)
//go:embed signup-script-template
var BashScript string
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
}