stringutil

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2022 License: Apache-2.0 Imports: 3 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

View Source
var ErrSyntax = errors.New("invalid syntax")

ErrSyntax indicates that a value does not have the right syntax for the target type.

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 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 IsExactMatch

func IsExactMatch(patTypes []byte) bool

IsExactMatch return true if no wildcard character

func MemoizeStr

func MemoizeStr(l func() string) fmt.Stringer

MemoizeStr returns memoized version of stringFunc.

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