Simplify string to int conversion where possible

This commit is contained in:
Howl
2016-06-13 21:48:09 +02:00
parent 2f027ce853
commit 32738aaae0
5 changed files with 20 additions and 25 deletions

7
common/int.go Normal file
View File

@@ -0,0 +1,7 @@
package common
// Int converts s to an int. If s in an invalid int, it defaults to 0.
func Int(s string) int {
r, _ := strconv.Atoi(s)
return r
}