Files
SNCTF/tools/checkid.go
jiayuqi7813 7cb171bc90 default
2022-05-21 23:29:23 +08:00

15 lines
236 B
Go

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)
}