validator

package
v1.1.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 11, 2022 License: MIT Imports: 4 Imported by: 1

Documentation

Overview

Package validator implements some validate function for string.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainChinese

func ContainChinese(s string) bool

ContainChinese check if the string contain mandarin chinese.

func IsAlpha

func IsAlpha(s string) bool

IsAlpha checks if the string contains only letters (a-zA-Z)

func IsBase64

func IsBase64(base64 string) bool

IsBase64 check if the string is base64 string.

func IsChineseIdNum

func IsChineseIdNum(id string) bool

IsChineseIdNum check if the string is chinese id number.

func IsChineseMobile

func IsChineseMobile(mobileNum string) bool

IsChineseMobile check if the string is chinese mobile number.

func IsChinesePhone

func IsChinesePhone(phone string) bool

IsChinesePhone check if the string is chinese phone number. Valid chinese phone is xxx-xxxxxxxx or xxxx-xxxxxxx

func IsCreditCard

func IsCreditCard(creditCart string) bool

IsCreditCard check if the string is credit card.

func IsDns

func IsDns(dns string) bool

IsDns check if the string is dns.

func IsEmail

func IsEmail(email string) bool

IsEmail check if the string is a email address.

func IsEmptyString

func IsEmptyString(s string) bool

IsEmptyString check if the string is empty.

func IsFloatStr

func IsFloatStr(s string) bool

IsFloatStr check if the string can convert to a float.

func IsIntStr

func IsIntStr(s string) bool

IsIntStr check if the string can convert to a integer.

func IsIp

func IsIp(ipstr string) bool

IsIp check if the string is a ip address.

func IsIpV4

func IsIpV4(ipstr string) bool

IsIpV4 check if the string is a ipv4 address.

func IsIpV6

func IsIpV6(ipstr string) bool

IsIpV6 check if the string is a ipv6 address.

func IsNumberStr

func IsNumberStr(s string) bool

IsNumberStr check if the string can convert to a number.

func IsRegexMatch

func IsRegexMatch(s, regex string) bool

IsRegexMatch check if the string match the regexp

func IsStrongPassword

func IsStrongPassword(password string, length int) bool

IsStrongPassword check if the string is strong password, if len(password) is less than the length param, return false Strong password: alpha(lower+upper) + number + special chars(!@#$%^&*()?><)

func IsWeakPassword

func IsWeakPassword(password string) bool

IsWeakPassword check if the string is weak password Weak password: only letter or only number or letter + number

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL