diff options
| author | Nikolaus Gotsche <n@softwarefools.com> | 2018-09-10 01:29:27 +0200 |
|---|---|---|
| committer | Nikolaus Gotsche <n@softwarefools.com> | 2018-09-10 01:29:27 +0200 |
| commit | 3b4bc634700694a4d84a23f6b6700a5484065736 (patch) | |
| tree | a6d91817b907d9a8de87e7fede1fc187b7d8b959 /utils.go | |
| parent | 4a4f372605d56f2241699da6a5bf8dae7eda2b86 (diff) | |
Tasks Checked Bills nicely TeX Rendered
Diffstat (limited to 'utils.go')
| -rw-r--r-- | utils.go | 29 |
1 files changed, 29 insertions, 0 deletions
@@ -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 +} |
