Package search
Overview ▹
Index ▹
Constants
CLDRVersion is the CLDR version from which the tables in this package are derived.
const CLDRVersion = "23"
UnicodeVersion is the Unicode version from which the tables in this package are derived.
const UnicodeVersion = "6.2.0"
Variables
var (
// Supported lists the languages for which search differs from its parent.
Supported language.Coverage
)
type IndexOption ¶
An IndexOption specifies how the Index methods of Pattern or Matcher should match the input.
type IndexOption byte
const ( // Anchor restricts the search to the start (or end for Backwards) of the // text. Anchor IndexOption = 1 << iota // Backwards starts the search from the end of the text. Backwards )
type Matcher ¶
A Matcher implements language-specific string matching.
type Matcher struct {
// contains filtered or unexported fields
}
func New ¶
func New(t language.Tag, opts ...Option) *Matcher
New returns a new Matcher for the given language and options.
func (*Matcher) Compile ¶
func (m *Matcher) Compile(b []byte) *Pattern
Compile compiles and returns a pattern that can be used for faster searching.
func (*Matcher) CompileString ¶
func (m *Matcher) CompileString(s string) *Pattern
CompileString compiles and returns a pattern that can be used for faster searching.
func (*Matcher) Equal ¶
func (m *Matcher) Equal(a, b []byte) bool
Equal reports whether a and b are equivalent.
func (*Matcher) EqualString ¶
func (m *Matcher) EqualString(a, b string) bool
EqualString reports whether a and b are equivalent.
func (*Matcher) Index ¶
func (m *Matcher) Index(b, pat []byte, opts ...IndexOption) (start, end int)
Index reports the start and end position of the first occurrence of pat in b or -1, -1 if pat is not present.
func (*Matcher) IndexString ¶
func (m *Matcher) IndexString(s, pat string, opts ...IndexOption) (start, end int)
IndexString reports the start and end position of the first occurrence of pat in s or -1, -1 if pat is not present.
type Option ¶
An Option configures a Matcher.
type Option func(*Matcher)
var ( // WholeWord restricts matches to complete words. The default is to match at // the character level. WholeWord Option = nil // Exact requires that two strings are their exact equivalent. For example // å would not match aa in Danish. It overrides any of the ignore options. Exact Option = nil // Loose causes case, diacritics and width to be ignored. Loose Option = loose // IgnoreCase enables case-insensitive search. IgnoreCase Option = ignoreCase // IgnoreDiacritics causes diacritics to be ignored ("ö" == "o"). IgnoreDiacritics Option = ignoreDiacritics // IgnoreWidth equates narrow with wide variants. IgnoreWidth Option = ignoreWidth )
type Pattern ¶
A Pattern is a compiled search string. It is safe for concurrent use.
type Pattern struct {
// contains filtered or unexported fields
}
func (*Pattern) Index ¶
func (p *Pattern) Index(b []byte, opts ...IndexOption) (start, end int)
Index reports the start and end position of the first occurrence of p in b or -1, -1 if p is not present.
func (*Pattern) IndexString ¶
func (p *Pattern) IndexString(s string, opts ...IndexOption) (start, end int)
IndexString reports the start and end position of the first occurrence of p in s or -1, -1 if p is not present.