stringset

package
Version: v3.4.12 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Deduplicate

func Deduplicate(input []string) []string

Deduplicate utilizes the Set type to generate a unique list of strings from the input slice.

Types

type Set

type Set map[string]nothing

Set implements set operations for string values.

func New

func New(initial ...string) Set

New returns a Set containing the values provided in the arguments.

func (Set) Has

func (s Set) Has(element string) bool

Has returns true if the receiver Set already contains the element string argument.

func (Set) Insert

func (s Set) Insert(element string)

Insert adds the element string argument to the receiver Set.

func (Set) InsertMany

func (s Set) InsertMany(elements ...string)

InsertMany adds all the elements strings into the receiver Set.

func (Set) Intersect

func (s Set) Intersect(other Set)

Intersect causes the receiver Set to only contain elements also found in the other Set argument.

func (Set) Len

func (s Set) Len() int

Len returns the number of elements in the receiver Set.

func (Set) Remove

func (s Set) Remove(element string)

Remove will delete the element string from the receiver Set.

func (*Set) Set

func (s *Set) Set(input string) error

Set implements the flag.Value interface.

func (Set) Slice

func (s Set) Slice() []string

Slice returns a string slice that contains all the elements in the Set.

func (*Set) String

func (s *Set) String() string

Set implements the flag.Value interface.

func (Set) Subtract

func (s Set) Subtract(other Set)

Subtract removes all elements in the other Set argument from the receiver Set.

func (Set) Union

func (s Set) Union(other Set)

Union adds all the elements from the other Set argument into the receiver Set.

type StringFilter

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

StringFilter implements an object that performs filtering of strings to ensure that only unique items get through the filter.

func NewStringFilter

func NewStringFilter() *StringFilter

NewStringFilter returns an initialized StringFilter.

func (*StringFilter) Duplicate

func (sf *StringFilter) Duplicate(s string) bool

Duplicate checks if the name provided has been seen before by this filter.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL