MCPcopy
hub / github.com/Terry-Mao/goim / SplitInt64s

Function SplitInt64s

pkg/strings/ints.go:80–94  ·  view source on GitHub ↗

SplitInt64s split string into int64 slice.

(s, p string)

Source from the content-addressed store, hash-verified

78
79// SplitInt64s split string into int64 slice.
80func SplitInt64s(s, p string) ([]int64, error) {
81 if s == "" {
82 return nil, nil
83 }
84 sArr := strings.Split(s, p)
85 res := make([]int64, 0, len(sArr))
86 for _, sc := range sArr {
87 i, err := strconv.ParseInt(sc, 10, 64)
88 if err != nil {
89 return nil, err
90 }
91 res = append(res, i)
92 }
93 return res, nil
94}

Callers 1

TestInt64Function · 0.85

Calls

no outgoing calls

Tested by 1

TestInt64Function · 0.68