Documentation
¶
Index ¶
- func Between(s string, min, max int) bool
- func In(v any, set any) bool
- func IsAccount(account string, min int, max int) bool
- func IsDigit(digit string) bool
- func IsEmail(email string) bool
- func IsIdCard(idCard string) bool
- func IsMobile(mobile string) bool
- func IsNumber(number string, langths ...int) bool
- func IsQQ(qq string) bool
- func IsTelephone(telephone string) bool
- func IsUrl(url string) bool
- func Length(s string, n int) bool
- func MaxLength(s string, n int) bool
- func MinLength(s string, n int) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func In ¶
In reports whether v is contained in set. When v is a slice or an array, it reports whether any of its elements is in the set; otherwise it reports whether v equals an element of the set.
func IsAccount ¶
IsAccount reports whether account is a valid account name. An account starts with a letter, may then contain letters, digits, underscores, hyphens and dots, and its length must be between min and max inclusive.
func IsDigit ¶
IsDigit reports whether digit is a valid numeric value. Positive and negative integers and floats are supported, but leading zeros and scientific notation are not.
func IsIdCard ¶ added in v2.1.0
IsIdCard reports whether idCard is a valid Chinese 18-digit resident identity card number. It validates the address code, the birth date, the sequence code and the check code.
The check-code algorithm is taken from https://zhuanlan.zhihu.com/p/608188853.
func IsMobile ¶
IsMobile reports whether mobile is a Chinese mobile phone number. It validates an 11-digit number covering the 13, 14, 15, 16, 17, 18 and 19 prefixes.
func IsNumber ¶
IsNumber reports whether number consists only of digits. Its length may optionally be constrained: a single langths argument requires an exact length, while two arguments require a minimum and a maximum length.
func IsQQ ¶
IsQQ reports whether qq is a valid QQ number. A QQ number has at least 5 digits and its first digit is not zero.
func IsTelephone ¶
IsTelephone reports whether telephone is a fixed-line phone number. It accepts formats with an area code, such as 028-5554540 or 0285-55545401, as well as 7- to 8-digit numbers without one.
func IsUrl ¶
IsUrl reports whether url is a valid URL. The http, https, ftp and file schemes are supported and matched case-insensitively.
Types ¶
This section is empty.