2023-01-19 20:38:09 +05:30
|
|
|
package utils
|
|
|
|
|
|
|
|
import (
|
2023-01-21 22:19:17 +05:30
|
|
|
_ "embed"
|
2023-01-19 20:38:09 +05:30
|
|
|
"strings"
|
|
|
|
)
|
|
|
|
|
2023-01-21 22:19:54 +05:30
|
|
|
//go:embed signup-script-template
|
2024-09-29 00:20:57 +05:30
|
|
|
var BashScript string
|
2023-01-21 22:19:17 +05:30
|
|
|
|
2023-01-19 20:38:09 +05:30
|
|
|
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
|
|
|
|
}
|