feat: super 包新增函数 IsNumber,用于判断一个值是否为数字类型
This commit is contained in:
parent
d9ba1bc85c
commit
518d47ae6a
|
@ -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
|
||||||
|
}
|
Loading…
Reference in New Issue