diff options
| author | Syndamia <kamen.d.mladenov@protonmail.com> | 2021-09-10 12:31:36 +0300 |
|---|---|---|
| committer | Syndamia <kamen.d.mladenov@protonmail.com> | 2021-09-10 12:31:36 +0300 |
| commit | 695dc46d540befe8486eb647c60d08ab0236fa60 (patch) | |
| tree | 3f7d2f6c1bcff02a3fe13c6b7052de50b05fde1e /go-src/utils/utils.go | |
| parent | e970dc54d59da50d818c013eecfac1c561f5e535 (diff) | |
| download | ctfc-695dc46d540befe8486eb647c60d08ab0236fa60.tar ctfc-695dc46d540befe8486eb647c60d08ab0236fa60.tar.gz ctfc-695dc46d540befe8486eb647c60d08ab0236fa60.zip | |
Implemented direct messages
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 |
