matching

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package matching provides matching features that find appropriate strings by using a passed input string.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Matched

type Matched struct {
	// Idx is the index of an item of the original slice which was used to
	// search matched strings.
	Idx int
	// Pos is the range of matched position.
	// [2]int represents an open interval of a position.
	Pos [2]int
	// contains filtered or unexported fields
}

Matched represents a result of FindAll.

func FindAll

func FindAll(in string, slice []string) []Matched

FindAll tries to find out sub-strings from slice that match the passed argument in. The returned slice is sorted by similarity scores in descending order.

type Mode

type Mode int
const (
	ModeSmart Mode = iota
	ModeCaseSensitive
	ModeCaseInsensitive
)

type Option

type Option func(*opt)

Option represents available matching options.

func WithMode

func WithMode(m Mode) Option

WithMode specifies a matching mode. The default mode is ModeSmart.

Jump to

Keyboard shortcuts

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