diff --git a/int_util.go b/int_util.go index 7b5b733..39eea76 100644 --- a/int_util.go +++ b/int_util.go @@ -50,3 +50,11 @@ func BoolToInt64(b bool) int64 { func Int64ToBool(i int64) bool { return i != 0 } + +func StringToValidInt64(s string) (int64, bool) { + i, err := strconv.ParseInt(s, 10, 64) + if err != nil { + return i, false + } + return i, true +}