Documentation ¶
Overview ¶
Match provides a simple pattern matcher with unicode support.
Index ¶
- Variables
- func Allowable(pattern string) (min, max string)
- func AnchorName(text string) string
- func Camel(s string) string
- func CamelCase[T ~string](s T) string
- func CamelCaseSlice(elem []string) string
- func CamelToSnake(name string) string
- func ConvertToCamelCase(s string) string
- func ConvertUnicode(s []byte) string
- func CountdownCutoff(s, key string) string
- func Cutoff(s, key string) string
- func CutoffContain(s, key string) string
- func FormatLen(s string, length int) string
- func HasHan(s string) bool
- func HasPrefixes(s string, prefixes []string) bool
- func In(s string, ss []string) bool
- func IsASCIIDigit(c byte) bool
- func IsASCIILower(c byte) bool
- func IsPattern(str string) bool
- func LowerCase(c byte) byte
- func LowerFirst(t string) string
- func Match(str, pattern string) bool
- func PrintComments(comments protogen.CommentSet, g *protogen.GeneratedFile)
- func QuoteToBytes(s string) []byte
- func Rand(length int) string
- func ReplaceBytesEmpty(s string, old ...byte) string
- func ReplaceRuneEmpty(s string, old ...rune) string
- func ToBytes(s string) []byte
- func ToString(b []byte) string
- func Unquote(s []byte) (t string, ok bool)
- func UpperCase(c byte) byte
- func UpperCaseFirst(t string) string
- type NumLetterSlice
Constants ¶
This section is empty.
Variables ¶
var HanPunctuation = []rune{
'\u3002', '\uff1b', '\uff0c', '\uff1a', '\u201c', '\u201d', '\uff08', '\uff09', '\u3001', '\uff1f', '\u300a', '\u300b',
}
[。;,:“”()、?《》]
Functions ¶
func Allowable ¶
Allowable parses the pattern and determines the minimum and maximum allowable values that the pattern can represent. When the max cannot be determined, 'true' will be returned for infinite.
func AnchorName ¶
Create returns a sanitized anchor name for the given text.
func CamelCaseSlice ¶
func CamelToSnake ¶
func ConvertToCamelCase ¶
func ConvertUnicode ¶
func CountdownCutoff ¶
CountdownCutoff("https://video.weibo.com/media/play?livephoto=https%3A%2F%2Flivephoto.us.sinaimg.cn%2F002OnXdGgx07YpcajtkH0f0f0100gv8Q0k01.mov", "%2F") 002OnXdGgx07YpcajtkH0f0f0100gv8Q0k01.mov
func Cutoff ¶
Cutoff("https://wx1.sinaimg.cn/orj360/6ebedee6ly1h566bbzyc6j20n00cuabd.jpg", "wx1") https://
func CutoffContain ¶
CutoffContain("https://f.video.weibocdn.com/o0/F9Nmm1ZJlx080UxqxlJK010412004rJS0E010.mp4?label=mp4_hd&template=540x960.24.0&ori=0&ps=1CwnkDw1GXwCQx&Expires=1670569613&ssig=fAQcBh4HGt&KID=unistore,video", "mp4") https://f.video.weibocdn.com/o0/F9Nmm1ZJlx080UxqxlJK010412004rJS0E010.mp4
func Match ¶
pattern:
{ term }
term:
'*' matches any sequence of non-Separator characters '?' matches any single non-Separator character c matches character c (c != '*', '?', '\\') '\\' c matches character c
func PrintComments ¶
func PrintComments(comments protogen.CommentSet, g *protogen.GeneratedFile)
func QuoteToBytes ¶
func ReplaceBytesEmpty ¶
func ReplaceRuneEmpty ¶
func Unquote ¶
unquote converts a quoted JSON string literal s into an actual string t. The rules are different than for Go, so cannot use strconv.Unquote.
func UpperCaseFirst ¶
Types ¶
type NumLetterSlice ¶
type NumLetterSlice[T any] ['z' - '0' + 1]T