summaryrefslogtreecommitdiff
path: root/pkg/utils/main.go
blob: f49313eb9748e040bf8782b561b0d2ad189c6af3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package utils

import (
	"strings"
	"unicode"
)

func RemoveSpacesFromStr(origin string) string {
	return strings.Map(func(r rune) rune {
		if unicode.IsSpace(r) {
			return -1
		}
		return r
	}, origin)
}

func StrInSlice(key string, sl []string) bool {
	for _, i := range sl {
		if key == i {
			return true
		}
	}
	return false
}