diff options
Diffstat (limited to 'go-src/utils/utils.go')
| -rw-r--r-- | go-src/utils/utils.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/go-src/utils/utils.go b/go-src/utils/utils.go index 5676744..d241da6 100644 --- a/go-src/utils/utils.go +++ b/go-src/utils/utils.go @@ -33,3 +33,18 @@ func AppendToFile(path string, value string) { allChatsFile.WriteString(value) allChatsFile.Close() } + +func StrShortenRight(s *string, amount int) { + *s = (*s)[:len(*s)-amount] +} + +// Special thanks to icza, over on https://stackoverflow.com/a/59375088 for the If constuction + +type If bool + +func (c If) Int(a, b int) int { + if c { + return a + } + return b +} |
