stringutil

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2022 License: Apache-2.0, Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PatMatch is the enumeration value for per-character match.
	PatMatch = iota + 1
	// PatOne is the enumeration value for '_' match.
	PatOne
	// PatAny is the enumeration value for '%' match.
	PatAny
)

Variables

This section is empty.

Functions

func CompilePattern

func CompilePattern(pattern string, escape byte) (patWeights []rune, patTypes []byte)

CompilePattern is a adapter for `CompilePatternInner`, `pattern` can be any unicode string.

func CompilePatternInner

func CompilePatternInner(pattern string, escape byte) (patWeights []rune, patTypes []byte)

CompilePatternInner handles escapes and wild cards convert pattern characters and pattern types.

func Copy

func Copy(src string) string

Copy deep copies a string.

func DoMatch

func DoMatch(str string, patChars []rune, patTypes []byte) bool

DoMatch is a adapter for `DoMatchInner`, `str` can be any unicode string.

func DoMatchInner

func DoMatchInner(str string, patWeights []rune, patTypes []byte, matcher func(a, b rune) bool) bool

DoMatchInner matches the string with patChars and patTypes. The algorithm has linear time complexity. https://research.swtch.com/glob

func IsExactMatch

func IsExactMatch(patTypes []byte) bool

IsExactMatch return true if no wildcard character

Types

type StringerFunc

type StringerFunc func() string

StringerFunc defines string func implement fmt.Stringer.

func (StringerFunc) String

func (l StringerFunc) String() string

String implements fmt.Stringer

type StringerStr

type StringerStr string

StringerStr defines a alias to normal string. implement fmt.Stringer

func (StringerStr) String

func (i StringerStr) String() string

String implements fmt.Stringer

Jump to

Keyboard shortcuts

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