Simplify string to int conversion where possible
This commit is contained in:
7
common/int.go
Normal file
7
common/int.go
Normal 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
|
||||
}
|
Reference in New Issue
Block a user