Documentation
¶
Overview ¶
Package is 包提供了一系列的判断函数
Index ¶
- func BankCard(val interface{}) bool
- func CNMobile(val interface{}) bool
- func CNPhone(val interface{}) bool
- func CNTel(val interface{}) bool
- func Email(val interface{}) bool
- func Empty(val interface{}, ptr bool) bool
- func GB11643(val interface{}) bool
- func GB32100(val interface{}) bool
- func HexColor(val interface{}) bool
- func IP(val interface{}) bool
- func IP4(val interface{}) bool
- func IP6(val interface{}) bool
- func ISBN(val interface{}) bool
- func ISBN10(val []byte) bool
- func ISBN13(val []byte) bool
- func Match(exp *regexp.Regexp, val interface{}) bool
- func Nil(val interface{}) bool
- func Number(val interface{}) bool
- func URL(val interface{}) bool
- func Zero(val interface{}, ptr bool) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CNPhone ¶
func CNPhone(val interface{}) bool
CNPhone 验证中国大陆的电话号码
支持如下格式:
0578-12345678-1234 057812345678-1234
若存在分机号,则分机号的连接符不能省略。
func Empty ¶
Empty 判断当前是否为空或是零值
ptr 表示当 val 是指针时,是否分析指向的值。
若是容器类型,长度为 0 也将返回 true, 但是 []string{""}空数组里套一个空字符串,不会被判断为空。
func GB11643 ¶
func GB11643(val interface{}) bool
GB11643 判断一个身份证是否符合 gb11643 标准
若是 15 位则当作一代身份证,仅简单地判断各位是否都是数字; 若是 18 位则当作二代身份证,会计算校验位是否正确; 其它位数都返回 false。
func ISBN ¶
func ISBN(val interface{}) bool
ISBN 判断是否为合法的 ISBN 串号
可以同时判断 ISBN10 和 ISBN13
有关 ISBN 的算法及其它相关内容,可参照http://zh.wikipedia.org/wiki/%E5%9B%BD%E9%99%85%E6%A0%87%E5%87%86%E4%B9%A6%E5%8F%B7
Types ¶
This section is empty.
Directories
¶
Path | Synopsis |
---|---|
Package gb11643 解析身分证详情
|
Package gb11643 解析身分证详情 |
Package gb32100 统一信用代码校验 GB32100—2015
|
Package gb32100 统一信用代码校验 GB32100—2015 |
Package luhn 模 10 校验算法 https://en.wikipedia.org/wiki/Luhn_algorithm 1.
|
Package luhn 模 10 校验算法 https://en.wikipedia.org/wiki/Luhn_algorithm 1. |
Click to show internal directories.
Click to hide internal directories.