summaryrefslogtreecommitdiff
path: root/utils.go
diff options
context:
space:
mode:
authorNikolaus Gotsche <n@softwarefools.com>2018-09-10 01:29:27 +0200
committerNikolaus Gotsche <n@softwarefools.com>2018-09-10 01:29:27 +0200
commit3b4bc634700694a4d84a23f6b6700a5484065736 (patch)
treea6d91817b907d9a8de87e7fede1fc187b7d8b959 /utils.go
parent4a4f372605d56f2241699da6a5bf8dae7eda2b86 (diff)
Tasks Checked Bills nicely TeX Rendered
Diffstat (limited to 'utils.go')
-rw-r--r--utils.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/utils.go b/utils.go
index c94f94b..ad9693d 100644
--- a/utils.go
+++ b/utils.go
@@ -4,6 +4,7 @@ import (
"fmt"
"bufio"
"os"
+ "math"
"strings"
"strconv"
"runtime"
@@ -95,3 +96,31 @@ func string2StringArray(in string,delim string)(out []string) {
}
return
}
+
+func Round(x, unit float64) (float64) {
+ return math.Round(x/unit) * unit
+}
+
+func cleanString(in string) (out string) {
+ work := strings.Replace(in,"/","-",-1)
+ work = strings.Replace(work,"*","-",-1)
+ work = strings.Replace(work,":","-",-1)
+ work = strings.Replace(work,"<","-",-1)
+ work = strings.Replace(work,">","-",-1)
+ work = strings.Replace(work,"?","-",-1)
+ work = strings.Replace(work,"|","-",-1)
+ work = strings.Replace(work,"+","-",-1)
+ work = strings.Replace(work,",","-",-1)
+ work = strings.Replace(work,";","-",-1)
+ work = strings.Replace(work,"=","-",-1)
+ work = strings.Replace(work,"[","-",-1)
+ out = strings.Replace(work,"]","-",-1)
+ return
+}
+
+func sumFloatArray(in []float64) (sum float64) {
+ for _,e := range in{
+ sum += e
+ }
+ return
+}