pattern_set

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: MulanPSL-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PatternSet

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

func NewPrefixPatternMatchSet

func NewPrefixPatternMatchSet(prefixes ...string) *PatternSet

NewPrefixPatternMatchSet returns a new PatternMatchSet with prefixes.

func NewSet

func NewSet(sliceFn SliceFn, patterns ...string) *PatternSet

NewSet returns a new PatternMatchSet with patterns.

func NewSuffixPatternMatchSet

func NewSuffixPatternMatchSet(suffixes ...string) *PatternSet

NewSuffixPatternMatchSet returns a new PatternMatchSet with suffixes.

func (*PatternSet) Add

func (p *PatternSet) Add(pattern string)

Add adds a pattern to the set.

func (*PatternSet) AddAll

func (p *PatternSet) AddAll(patterns ...string)

AddAll adds all patterns to the set.

func (*PatternSet) Match

func (p *PatternSet) Match(content string) bool

Match returns true if the content matches any pattern.

func (*PatternSet) MatchedSlice

func (p *PatternSet) MatchedSlice(content string) string

MatchedSlice returns the matched slice of the content.

type SliceFn

type SliceFn func(content string, k int) string

Jump to

Keyboard shortcuts

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