diff options
| author | Syndamia <kamen.d.mladenov@protonmail.com> | 2021-07-22 14:02:11 +0300 |
|---|---|---|
| committer | Syndamia <kamen.d.mladenov@protonmail.com> | 2021-07-22 14:02:11 +0300 |
| commit | 3d3324e36311aadd02e25e8e11e5d98272c0aa0e (patch) | |
| tree | 8e30ae5927148506d4644a8de1bbdc128fb53437 /go-src/utils/utils.go | |
| parent | ffc2c1273183b488de9cc4fc282379c2a042bd6d (diff) | |
| download | ctfc-3d3324e36311aadd02e25e8e11e5d98272c0aa0e.tar ctfc-3d3324e36311aadd02e25e8e11e5d98272c0aa0e.tar.gz ctfc-3d3324e36311aadd02e25e8e11e5d98272c0aa0e.zip | |
Moved some stuff from windows.go to windowsHelpers.go, implemented some consistency and code organization improvements
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 +} |
