stringx

package
v0.11.8 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

* @Author: kamalyes 501893067@qq.com * @Date: 2023-07-28 00:50:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-11-11 13:08:58 * @FilePath: \go-toolbox\pkg\stringx\base.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.

* @Author: kamalyes 501893067@qq.com * @Date: 2023-07-28 00:50:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-11-01 02:15:52 * @FilePath: \go-toolbox\pkg\stringx\contains.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.

* @Author: kamalyes 501893067@qq.com * @Date: 2023-07-28 00:50:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-08-03 23:11:56 * @FilePath: \go-toolbox\pkg\stringx\format.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.

* @Author: kamalyes 501893067@qq.com * @Date: 2023-07-28 00:50:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-08-03 16:55:01 * @FilePath: \go-toolbox\pkg\stringx\index.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.

* @Author: kamalyes 501893067@qq.com * @Date: 2023-07-28 00:50:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-11-09 20:06:12 * @FilePath: \go-toolbox\pkg\stringx\regexp.go * @Description: 字符串正则表达式工具包 * * Copyright (c) 2024 by kamalyes, All Rights Reserved.

* @Author: kamalyes 501893067@qq.com * @Date: 2023-07-28 00:50:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-08-03 11:02:37 * @FilePath: \go-toolbox\pkg\stringx\remove.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.

* @Author: kamalyes 501893067@qq.com * @Date: 2023-07-28 00:50:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-07-30 17:26:07 * @FilePath: \go-toolbox\pkg\stringx\repeat.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.

* @Author: kamalyes 501893067@qq.com * @Date: 2023-07-28 00:50:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-10-16 19:49:20 * @FilePath: \go-toolbox\pkg\stringx\replace.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.

* @Author: kamalyes 501893067@qq.com * @Date: 2023-07-28 00:50:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-07-30 17:26:07 * @FilePath: \go-toolbox\pkg\stringx\split.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.

* @Author: kamalyes 501893067@qq.com * @Date: 2023-07-28 00:50:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-07-30 17:26:07 * @FilePath: \go-toolbox\pkg\stringx\start_end_with.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.

* @Author: kamalyes 501893067@qq.com * @Date: 2023-07-28 00:50:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-08-03 10:15:25 * @FilePath: \go-toolbox\pkg\stringx\sub.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.

* @Author: kamalyes 501893067@qq.com * @Date: 2023-07-28 00:50:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-07-30 17:26:07 * @FilePath: \go-toolbox\pkg\stringx\trim.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddPrefixIfNot

func AddPrefixIfNot(str string, prefix string) string

AddPrefixIfNot 如果给定字符串不是以prefix开头的,在开头补充 prefix

func AddSuffixIfNot

func AddSuffixIfNot(str string, suffix string) string

AddSuffixIfNot 如果给定字符串不是以suffix结尾的,在尾部补充 suffix

func CalculateMD5Hash

func CalculateMD5Hash(input string) string

CalculateMD5Hash 计算string md5 hash值

func CleanEmpty

func CleanEmpty(str string) string

CleanEmpty 清除空白串

func Coalesce added in v0.11.6

func Coalesce(s ...string) string

Coalesce 高性能字符串拼接

func CompareIgnoreCase

func CompareIgnoreCase(str1 string, str2 string) int

CompareIgnoreCase 比较两个字符串,用于排序(大小写不敏感)

0 相等;<0 小于; >0 大于

func Contains

func Contains(value string, searchStr string) bool

Contains 指定字符是否在字符串中出现过

func ContainsAll

func ContainsAll(str string, searchStrs []string) bool

ContainsAll 检查指定字符串中是否含给定的所有字符串

func ContainsAny

func ContainsAny(value string, searchStrs []string) bool

ContainsAny 查找指定字符串是否包含指定字符串列表中的任意一个字符串

func ContainsAnyIgnoreCase

func ContainsAnyIgnoreCase(str string, searchStrs []string) bool

ContainsAnyIgnoreCase 找指定字符串是否包含指定字符串列表中的任意一个字符串(忽略大小写)

func ContainsBlank

func ContainsBlank(str string) bool

ContainsBlank 给定字符串是否包含空白符(空白符包括空格、制表符、全角空格和不间断空格)

func ContainsIgnoreCase

func ContainsIgnoreCase(value string, searchStr string) bool

ContainsIgnoreCase 指定字符是否在字符串中出现过(忽略大小写)

func ConvertCharacterStyle added in v0.11.6

func ConvertCharacterStyle(input string, caseType CharacterStyle) string

ConvertCharacterStyle 根据指定的 CharacterStyle 将字符串转换为相应的格式

func Count

func Count(str string, searchStr string) int

Count 统计指定内容中包含指定字符串的数量

func Cut

func Cut(str string, n int) []string

Cut 将字符串切分为n等份

func EndWith

func EndWith(str string, suffix string) bool

EndWith 是否以指定字符串结尾

func EndWithAny

func EndWithAny(str string, suffixes []string) bool

EndWithAny 给定字符串是否以任何一个字符串结尾 给定字符串和数组为空都返回false

func EndWithAnyIgnoreCase

func EndWithAnyIgnoreCase(str string, suffixes []string) bool

EndWithAnyIgnoreCase 给定字符串是否以任何一个字符串结尾(忽略大小写) 给定字符串和数组为空都返回false

func EndWithIgnoreCase

func EndWithIgnoreCase(str string, suffix string) bool

EndWithIgnoreCase 是否以指定字符串结尾,忽略大小写

func Equals

func Equals(str1 string, str2 string) bool

Equals 比较2个字符串(大小写敏感)

func EqualsAny

func EqualsAny(str1 string, str2 []string) bool

EqualsAny 给定字符串是否与提供的中任一字符串相同,相同则返回true,没有相同的返回false; 如果参与比对的字符串列表为空,返回false

func EqualsAnyIgnoreCase

func EqualsAnyIgnoreCase(str1 string, str2 []string) bool

EqualsAnyIgnoreCase 给定字符串是否与提供的中任一字符串相同(忽略大小写),相同则返回true,没有相同的返回false; 如果参与比对的字符串列表为空,返回false

func EqualsAt

func EqualsAt(value string, position int, subStr string) bool

EqualsAt 字符串指定位置的字符是否与给定字符相同

func EqualsIgnoreCase

func EqualsIgnoreCase(str1 string, str2 string) bool

EqualsIgnoreCase 比较2个字符串(大小写不敏感)

func ExtractValue

func ExtractValue(extra string, key string, searchPrefix string) string

ExtractValue 从给定的字符串中提取指定的键的值

func Fill

func Fill(str string, char string, length int, isPre bool) string

Fill 将已有字符串填充为规定长度,如果已有字符串超过这个长度则返回这个字符串

func FillAfter

func FillAfter(str string, char string, length int) string

FillAfter 将已有字符串填充为规定长度,如果已有字符串超过这个长度则返回这个字符串

func FillBefore

func FillBefore(str string, char string, length int) string

FillBefore 将已有字符串填充为规定长度,如果已有字符串超过这个长度则返回这个字符串

func Format

func Format(template string, params map[string]interface{}) string

Format 通过map中的参数 格式化字符串 map = {a: "aValue", b: "bValue"} format("{a} and {b}", map) ---=》 aValue and bValue

func GetContainsStr

func GetContainsStr(str string, searchStrs []string) string

GetContainsStr 查找指定字符串是否包含指定字符串列表中的任意一个字符串,如果包含返回找到的第一个字符串 不存在返回空串

func HasLocalIP added in v0.11.5

func HasLocalIP(ip string) bool

HasLocalIP 方法检查给定的IP地址是否是本地地址

func Hide

func Hide(str string, startInclude int, endExclude int) string

Hide 替换指定字符串的指定区间内字符为"*" 俗称:脱敏功能

func IndexOf

func IndexOf(str string, subStr string) int

IndexOf 返回字符在原始字符串的下标

func IndexOfByRange

func IndexOfByRange(str string, subStr string, start int, end int) int

IndexOfByRange 指定范围内查找指定字符

func IndexOfByRangeStart

func IndexOfByRangeStart(str string, subStr string, start int) int

IndexOfByRangeStart 指定范围内查找指定字符

func IndexOfIgnoreCase

func IndexOfIgnoreCase(str string, subStr string) int

IndexOfIgnoreCase 返回字符在原始字符串的下标(大小写不敏感)

func IndexOfIgnoreCaseByRange

func IndexOfIgnoreCaseByRange(str string, subStr string, start int) int

IndexOfIgnoreCaseByRange 从指定下标开始,返回在字符串中的下标 (大小不敏感)

func IndexedFormat

func IndexedFormat(template string, params []interface{}) string

IndexedFormat 有序的格式化文本,使用{number}做为占位符 通常使用:format("this is {0} for {1}", "a", "b") =》 this is a for b

func InsertSpaces

func InsertSpaces(str string, interval int) string

InsertSpaces 插入空值 InsertSpaces 插入空值

func IsChineseCharacter added in v0.11.5

func IsChineseCharacter(str string) (isContains bool, count int)

IsChineseCharacter 检查字符串是否为纯汉字

func IsGlobalUnicast added in v0.11.5

func IsGlobalUnicast(ip string) bool

IsGlobalUnicast 检查给定的 IP 地址是否是全球单播地址

func IsLinkLocal added in v0.11.5

func IsLinkLocal(ip net.IP) bool

IsLinkLocal 检查给定的 IP 是否为链路本地地址

func IsTrueString added in v0.11.5

func IsTrueString(s string) bool

IsTrueString 检查字符串是否表示为 true

func IsUniqueLocalAddress added in v0.11.5

func IsUniqueLocalAddress(ip net.IP) bool

IsUniqueLocalAddress 检查给定的 IP 是否为唯一本地地址(ULA)

func LastIndexOf

func LastIndexOf(str string, subStr string) int

LastIndexOf 返回最后出现指定字符串的下标

func LastIndexOfByRangeStart

func LastIndexOfByRangeStart(str string, subStr string, start int) int

LastIndexOfByRangeStart 从指定下标开始,返回最后出现指定字符串的下标

func LastIndexOfIgnoreCase

func LastIndexOfIgnoreCase(str string, subStr string) int

LastIndexOfIgnoreCase 返回最后出现指定字符串的下标(大小写不敏感)

func Length

func Length(str string) int

Length 计算长度

func MatchEnCharacterDotUnderLine added in v0.11.5

func MatchEnCharacterDotUnderLine(str string) bool

MatchEnCharacterDotUnderLine 检查字符串是否只包含字母、数字、点号和下划线

func OrdinalIndexOf

func OrdinalIndexOf(str string, subStr string, ordinal int, start ...int) int

OrdinalIndexOf 返回字符串 subStr 在字符串 str 中第 ordinal 次出现的位置。 如果 str="" 或 subStr=" 或 ordinal≥0 则返回-1

func Pad

func Pad(input string, minLength int, paddler ...*Paddler) string

Pad 输入的字符长度<minLength时自动补位*

func RemoveAll

func RemoveAll(str string, strToRemove string) string

RemoveAll 移除字符串中所有给定字符串;removeAll("aa-bb-cc-dd", "-") =》 aabbccdd

func RemoveAllLineBreaks

func RemoveAllLineBreaks(str string) string

RemoveAllLineBreaks 去除所有换行符,包括:\r \n

func RemoveAny

func RemoveAny(str string, strsToRemove []string) string

RemoveAny 移除字符串中所有给定字符串,当某个字符串出现多次,则全部移除

func RemovePrefix

func RemovePrefix(str string, prefix string) string

RemovePrefix 去掉指定前缀

func RemovePrefixIgnoreCase

func RemovePrefixIgnoreCase(str string, prefix string) string

RemovePrefixIgnoreCase 忽略大小写去掉指定前缀

func RemoveSuffix

func RemoveSuffix(str string, suffix string) string

RemoveSuffix 去掉指定后缀

func RemoveSuffixIgnoreCase

func RemoveSuffixIgnoreCase(str string, suffix string) string

RemoveSuffixIgnoreCase 去掉指定后缀(忽略大小写)

func RemoveSymbols added in v0.11.5

func RemoveSymbols(s string) string

RemoveSymbols 使用正则表达式去掉字符串中的所有符号

func Repeat

func Repeat(str string, count int) string

Repeat 重复字符串

func RepeatAndJoin

func RepeatAndJoin(str string, delimiter string, count int) string

RepeatAndJoin 重复某个字符串并通过分界符连接

func RepeatByLength

func RepeatByLength(str string, padLen int) string

RepeatByLength 重复某个字符串到指定长度

func Replace

func Replace(source string, searchStr string, replacement string, replaceCount int) string

Replace 替换字符串

func ReplaceAll

func ReplaceAll(source string, searchStr string, replacement string) string

ReplaceAll 替换字符串

func ReplaceAllIgnoreCase

func ReplaceAllIgnoreCase(source string, searchStr string, replacement string) string

ReplaceAllIgnoreCase 替换字符串

func ReplaceIgnoreCase

func ReplaceIgnoreCase(source string, searchStr string, replacement string, replaceCount int) string

ReplaceIgnoreCase 替换字符串

func ReplaceSpecialChars

func ReplaceSpecialChars(str string, replaceValue rune) string

ReplaceSpecialChars 去掉特殊符号、转为自定义

func ReplaceWithIndex

func ReplaceWithIndex(str string, startIndex int, endIndex int, replacedStr string) string

ReplaceWithIndex 按照指定区间替换字符串 startIndex 开始位置(包含) endIndex 结束位置(不包含)

func ReplaceWithMatcher

func ReplaceWithMatcher(str string, regex string, replaceFun func(string) string) string

ReplaceWithMatcher 通过正则表达式替换字符串

func Reverse

func Reverse(str string) string

Reverse 反转给定的字符串

func SafeIndexOfByRange

func SafeIndexOfByRange(str string, subStr string, options ...func(*searchOptions)) (index int)

SafeIndexOfByRange 在指定范围内查找指定字符,避免下标溢出

func SetPadPosition

func SetPadPosition(p *Paddler, position PadPosition)

func Split

func Split(str string, separator string) []string

Split 分割字符串

func SplitAfterMapping

func SplitAfterMapping[T any](str string, separator string, mapping func(s string) (T, error)) []T

SplitAfterMapping 切分字符串,切分之后通过mapping转换并返回

func SplitByLen

func SplitByLen(str string, length int) []string

SplitByLen 根据给定长度,将给定字符串截取为多个部分

func SplitLimit

func SplitLimit(str string, separator string, limit int) []string

SplitLimit 分割字符串,限制分片数

func SplitTrim

func SplitTrim(str string, separator string) []string

SplitTrim 切分字符串,去除切分后每个元素两边的空白符,去除空白项

func SplitTrimLimit

func SplitTrimLimit(str string, separator string, limit int) []string

SplitTrimLimit 切分字符串,去除切分后每个元素两边的空白符,去除空白项,限制分片数

func StartWith

func StartWith(str string, prefix string) bool

StartWith 字符串是否以给定字符开始

func StartWithAny

func StartWithAny(str string, prefixes []string) bool

StartWithAny 给定字符串是否以任何一个字符串开始; 给定字符串和数组为空都返回false

func StartWithAnyIgnoreCase

func StartWithAnyIgnoreCase(str string, prefixes []string) bool

StartWithAnyIgnoreCase 给定字符串是否以任何一个字符串开始(忽略大小写) 给定字符串和数组为空都返回false

func StartWithIgnoreCase

func StartWithIgnoreCase(str string, prefix string) bool

StartWithIgnoreCase 字符串是否以给定字符开始-忽略大小写

func SubAfter

func SubAfter(str string, separator string, isLastSeparator bool) string

SubAfter 截取分隔字符串之后的字符串,不包括分隔字符串

func SubBefore

func SubBefore(str string, separator string, isLastSeparator bool) string

SubBefore 截取分隔字符串之前的字符串,不包括分隔字符串 isLastSeparator - 是否查找最后一个分隔字符串(多次出现分隔字符串时选取最后一个),true为选取最后一个

func SubBetween

func SubBetween(str string, before string, after string) string

SubBetween 截取指定字符串中间部分,不包括标识字符串

func SubBetweenAll

func SubBetweenAll(str string, prefix string, suffix string) []string

SubBetweenAll 截取指定字符串多段中间部分,不包括标识字符串

func Trim

func Trim(str string) string

Trim 除去字符串头尾部的空白

func TrimEnd

func TrimEnd(str string) string

TrimEnd 除去字符串尾部的空白

func TrimStart

func TrimStart(str string) string

TrimStart 除去字符串头部的空白

func Truncate

func Truncate(str string, maxBytes int) string

Truncate 截断字符串,使用不超过maxBytes长度

func TruncateAppendEllipsis

func TruncateAppendEllipsis(str string, maxBytes int) string

TruncateAppendEllipsis 截断字符串,使用不超过maxBytes长度。截断后自动追加省略号(...) 用于存储数据库varchar且编码为UTF-8的字段

func WithEnd

func WithEnd(end int) func(*searchOptions)

WithEnd 用于配置结束位置

func WithStart

func WithStart(start int) func(*searchOptions)

WithStart 用于配置起始位置

Types

type AnyRegs added in v0.11.5

type AnyRegs struct {
	// contains filtered or unexported fields
}

AnyRegs 包含各种正则表达式的结构体

func NewAnyRegs added in v0.11.5

func NewAnyRegs() *AnyRegs

NewAnyRegs 创建一个新的 AnyRegs 实例,并编译所有正则表达式

func (*AnyRegs) IsHex added in v0.11.5

func (g *AnyRegs) IsHex(input string) bool

IsHex 检查字符串是否为有效的十六进制数

func (*AnyRegs) MatchChineseIDCardNumber added in v0.11.5

func (g *AnyRegs) MatchChineseIDCardNumber(id string) bool

MatchChineseIDCardNumber 检查字符串是否为有效的大陆身份证号

func (*AnyRegs) MatchChinesePhoneNumber added in v0.11.5

func (g *AnyRegs) MatchChinesePhoneNumber(str string) bool

MatchChinesePhoneNumber 检查字符串是否为有效的大陆手机号

func (*AnyRegs) MatchContainChineseCharacter added in v0.11.5

func (g *AnyRegs) MatchContainChineseCharacter(str string) bool

MatchContainChineseCharacter 检查字符串是否包含中文字符

func (*AnyRegs) MatchDoubleByte added in v0.11.5

func (g *AnyRegs) MatchDoubleByte(input string) bool

MatchDoubleByte 检查字符串是否包含双字节字符(包括汉字)

func (*AnyRegs) MatchEmail added in v0.11.5

func (g *AnyRegs) MatchEmail(str string) bool

MatchEmail 检查字符串是否为有效的email

func (*AnyRegs) MatchEmptyLine added in v0.11.5

func (g *AnyRegs) MatchEmptyLine(input string) bool

MatchEmptyLine 检查字符串是否为空行

func (*AnyRegs) MatchEnCharacter added in v0.11.5

func (g *AnyRegs) MatchEnCharacter(str string) bool

MatchEnCharacter 检查字符串是否为纯英文字符串(大小写不敏感)

func (*AnyRegs) MatchGeNNumber added in v0.11.5

func (g *AnyRegs) MatchGeNNumber(str string, n int) bool

MatchGeNNumber 检查字符串是否为长度不小于n的纯数字

func (*AnyRegs) MatchIPv4 added in v0.11.5

func (g *AnyRegs) MatchIPv4(input string) bool

MatchIPv4 检查字符串是否为有效的IPv4地址

func (*AnyRegs) MatchIPv6 added in v0.11.5

func (g *AnyRegs) MatchIPv6(input string) bool

MatchIPv6 检查字符串是否为有效的IPv6地址

func (*AnyRegs) MatchIntOrFloat added in v0.11.5

func (g *AnyRegs) MatchIntOrFloat(str string) bool

MatchIntOrFloat 检查字符串是否为整数或小数

func (*AnyRegs) MatchIsContainSpecialCharacter added in v0.11.5

func (g *AnyRegs) MatchIsContainSpecialCharacter(str string) bool

MatchIsContainSpecialCharacter 检查字符串是否包含特殊字符

func (*AnyRegs) MatchLenNNumber added in v0.11.5

func (g *AnyRegs) MatchLenNNumber(str string, n int) bool

MatchLenNNumber 检查字符串是否为长度为n的纯数字

func (*AnyRegs) MatchLowerEnCharacter added in v0.11.5

func (g *AnyRegs) MatchLowerEnCharacter(str string) bool

MatchLowerEnCharacter 检查字符串是否为纯小写英文字符串

func (*AnyRegs) MatchMNIntervalNumber added in v0.11.5

func (g *AnyRegs) MatchMNIntervalNumber(str string, m, n int) bool

MatchMNIntervalNumber 检查字符串是否为长度在m到n之间的纯数字

func (*AnyRegs) MatchMNNovelsOfRealNumber added in v0.11.5

func (g *AnyRegs) MatchMNNovelsOfRealNumber(str string, m, n int) bool

MatchMNNovelsOfRealNumber 检查字符串是否为m到n位小数的正实数

func (*AnyRegs) MatchNLeCharacter added in v0.11.5

func (g *AnyRegs) MatchNLeCharacter(str string, n int) bool

MatchNLeCharacter 检查字符串是否为长度为n的字符

func (*AnyRegs) MatchNNovelsOfRealNumber added in v0.11.5

func (g *AnyRegs) MatchNNovelsOfRealNumber(str string, n int) bool

MatchNNovelsOfRealNumber 检查字符串是否为有n位小数的正实数

func (*AnyRegs) MatchNanZeroNegNumber added in v0.11.5

func (g *AnyRegs) MatchNanZeroNegNumber(str string) bool

MatchNanZeroNegNumber 检查字符串是否为非零的负整数

func (*AnyRegs) MatchNanZeroNumber added in v0.11.5

func (g *AnyRegs) MatchNanZeroNumber(str string) bool

MatchNanZeroNumber 检查字符串是否为非零的正整数

func (*AnyRegs) MatchNumber added in v0.11.5

func (g *AnyRegs) MatchNumber(str string) bool

MatchNumber 检查字符串是否为纯数字

func (*AnyRegs) MatchNumberEnCharacter added in v0.11.5

func (g *AnyRegs) MatchNumberEnCharacter(str string) bool

MatchNumberEnCharacter 检查字符串是否由数字和26个英文字母组成(大小写不敏感)

func (*AnyRegs) MatchNumberEnUnderscores added in v0.11.5

func (g *AnyRegs) MatchNumberEnUnderscores(str string) bool

MatchNumberEnUnderscores 检查字符串是否由数字和26个英文字母或下划线组成(大小写不敏感)

func (*AnyRegs) MatchPass1 added in v0.11.5

func (g *AnyRegs) MatchPass1(str string, m, n int) bool

MatchPass1 检查密码1是否符合规则:由数字、26个英文字母或下划线组成的英文开头的字符串,长度在m到n位之间

func (*AnyRegs) MatchPass2 added in v0.11.5

func (g *AnyRegs) MatchPass2(str string) bool

MatchPass2 检查密码2是否符合规则: 密码长度至少为8个字符。 包含至少一个小写字母。 包含至少一个大写字母。 包含至少一个数字。 包含至少一个特殊字符(例如 !@#$%^&*() 等)

func (*AnyRegs) MatchStartingWithNonZero added in v0.11.5

func (g *AnyRegs) MatchStartingWithNonZero(str string) bool

MatchStartingWithNonZero 检查字符串是否为非零开头的纯数字

func (*AnyRegs) MatchTime added in v0.11.5

func (g *AnyRegs) MatchTime(input string) bool

MatchTime 检查字符串是否符合时间格式

func (*AnyRegs) MatchUpEnCharacter added in v0.11.5

func (g *AnyRegs) MatchUpEnCharacter(str string) bool

MatchUpEnCharacter 检查字符串是否为纯大写英文字符串

type CharacterStyle added in v0.11.6

type CharacterStyle int
const (
	SnakeCharacterStyle  CharacterStyle = iota // 表示蛇形命名法(例如:hello_world)
	StudlyCharacterStyle                       // 表示每个单词首字母大写的风格(例如:HelloWorld)
	CamelCharacterStyle                        // 表示驼峰命名法(例如:helloWorld)
)

type PadPosition

type PadPosition int
const (
	Left PadPosition = iota
	Right
	Middle
)

type Paddler

type Paddler struct {
	Position PadPosition
}

Jump to

Keyboard shortcuts

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