This commit is contained in:
jiayuqi7813
2022-05-21 23:29:23 +08:00
parent b8859af6d8
commit 7cb171bc90
83 changed files with 1687 additions and 0 deletions

14
tools/checkid.go Normal file
View File

@@ -0,0 +1,14 @@
package tools
import "regexp"
// CheckID 验证id是否为非负正整数。
func CheckID(id string) bool {
if id == "1" {
return false
}
pattern := `^[1-9]\d*$`
reg := regexp.MustCompile(pattern)
return reg.MatchString(id)
}