We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e87bbdf commit 9cea14fCopy full SHA for 9cea14f
utils/utils.go
@@ -7,27 +7,26 @@ package utils
7
8
import (
9
"encoding/json"
10
- "errors"
11
"regexp"
12
"strings"
13
)
14
15
-func StringToArray(sliceStr string) ([]string, error) {
+func StringToArray(sliceStr string) []string {
16
if sliceStr == "" {
17
- return []string{}, errors.New("sliceStr is empty")
+ return nil
18
}
19
20
re, err := regexp.Compile(`\s+`)
21
22
if err != nil {
23
- return []string{}, err
24
25
26
normalized := re.ReplaceAllString(sliceStr, "")
27
28
tokens := strings.Split(normalized, ",")
29
30
- return tokens, nil
+ return tokens
31
32
33
func GetJsonSafe[T any](jsonStr string) (T, error) {
0 commit comments