matcher

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2021 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type M

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

M represents

func New

func New(opts ...Option) *M

New returns new Matcher.

func (*M) Match

func (m *M) Match(x, s string) bool

Match returns true when x matches s.

func (*M) MatchSlice

func (m *M) MatchSlice(x string, ss []string) bool

MatchSlice returns true when x matches element of ss.

type Matcher

type Matcher interface {
	Match(x, s string)
	MatchSlice(x string, ss []string)
}

Matcher checks if two strings matches. By default: - Match checks if x is substring of s, case-insensitive. - MatchSlice checks if x is substring of any element of ss, case-insensitive.

type Option

type Option func(*M)

Option allows to apply certain options to Matcher, like case sensitive matching.

func WithCaseSensitive

func WithCaseSensitive() Option

WithCaseSensitive sets case sensitive matching.

func WithExactMatch

func WithExactMatch() Option

WithExactMatch sets exact string matching.

Jump to

Keyboard shortcuts

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