diff options
Diffstat (limited to 'go-src/utils/utils.go')
| -rw-r--r-- | go-src/utils/utils.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/go-src/utils/utils.go b/go-src/utils/utils.go index d6fc47c..271dd3e 100644 --- a/go-src/utils/utils.go +++ b/go-src/utils/utils.go @@ -3,6 +3,7 @@ package utils import ( "math" "os" + "strings" ) // Repeats a rune given amount of times and returns the result as a string @@ -53,6 +54,21 @@ func StrShortenRight(s *string, amount int) { *s = (*s)[:len(*s)-amount] } +func StrMSplit(s string, seps ...string) (sret []string) { + for _, sep := range seps { + if len(sret) == 0 { + sret = strings.Split(s, sep) + } else { + var tmp []string + for _, sepStr := range sret { + tmp = append(tmp, strings.Split(sepStr, sep)...) + } + sret = tmp + } + } + return +} + func MaxInt(x int, y int) int { if x > y { return x |
