diff options
Diffstat (limited to 'util.go')
| -rw-r--r-- | util.go | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -5,6 +5,7 @@ import ( "html/template" "log" "net/http" + "strconv" ) func reloadTemplate(t **template.Template, files ...string) error { @@ -23,3 +24,12 @@ func templateError(err error, w http.ResponseWriter) { http.Error(w, msg, http.StatusInternalServerError) log.Println(msg) } + + +func AtoiOrZero(s string) int { + i, err := strconv.Atoi(s) + if err != nil { + return 0 + } + return i +} |
