From 518d47ae6a13eda45cd7d650d5e07477869c2eff Mon Sep 17 00:00:00 2001 From: kercylan98 Date: Sat, 26 Aug 2023 09:18:35 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20super=20=E5=8C=85=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=87=BD=E6=95=B0=20IsNumber=EF=BC=8C=E7=94=A8=E4=BA=8E?= =?UTF-8?q?=E5=88=A4=E6=96=AD=E4=B8=80=E4=B8=AA=E5=80=BC=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E4=B8=BA=E6=95=B0=E5=AD=97=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/super/number.go | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 utils/super/number.go diff --git a/utils/super/number.go b/utils/super/number.go new file mode 100644 index 00000000..8bbd565c --- /dev/null +++ b/utils/super/number.go @@ -0,0 +1,9 @@ +package super + +import "reflect" + +// IsNumber 判断是否为数字 +func IsNumber(v any) bool { + kind := reflect.Indirect(reflect.ValueOf(v)).Kind() + return kind >= reflect.Int && kind <= reflect.Float64 +}