From 9a36fac2be35749e2426db0eeb911dd8eef0152f Mon Sep 17 00:00:00 2001 From: Vladimir Barsukov Date: Wed, 12 Jun 2024 18:50:39 +0200 Subject: [PATCH] parse num --- zutils/parse.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 zutils/parse.go diff --git a/zutils/parse.go b/zutils/parse.go new file mode 100644 index 0000000..0624605 --- /dev/null +++ b/zutils/parse.go @@ -0,0 +1,24 @@ +package zutils + +import "strconv" + +func ParseFloat(s string) float64 { + f, _ := strconv.ParseFloat(s, 64) + + return f +} +func ParseInt(s string) int { + f, _ := strconv.ParseInt(s, 10, 32) + + return int(f) +} +func ParseInt64(s string) int64 { + f, _ := strconv.ParseInt(s, 10, 64) + + return f +} +func ParseUInt(s string) uint64 { + f, _ := strconv.ParseUint(s, 10, 64) + + return f +} -- GitLab