strings

package
v0.0.0-...-2435b8f Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(list []string, item string) bool

Contains reports whether item is an element of list. If you expect to do this a lot, prefer converting to a Set. This is fine for one-offs.

func Equal

func Equal(expect, actual []string) bool

Equal reports whether expect and actual contain exactly the same strings, without regard to order.

Types

type Set

type Set map[string]bool

Set is a representation of a set of strings. If you have a []string that you want to do a lot of set operations on, prefer using this type. If you only have a one-off usage, use SliceContains.

func New

func New(ss ...string) Set

New returns a new Set containing the given strings.

func (Set) Add

func (s Set) Add(str string) Set

Add modifies s in-place to include str.

func (Set) AddSet

func (s Set) AddSet(addSet Set) Set

AddSet modifies s in-place to include all the elements of addSet.

func (Set) AddSlice

func (s Set) AddSlice(slice []string) Set

AddSlice modifies s in-place to include all the elements of slice.

func (Set) Contains

func (s Set) Contains(val string) bool

Contains reports whether val is a member of s.

func (Set) Intersect

func (s Set) Intersect(s2 Set) Set

Intersect returns a Set representing the intersection of the two slices.

func (Set) IsEmpty

func (s Set) IsEmpty() bool

Reports whether the set is empty.

func (Set) Remove

func (s Set) Remove(str string)

Remove modifies s in-place to remove str.

func (Set) RemoveSet

func (s Set) RemoveSet(removeSet Set) Set

RemoveSet modifies s in-place to remove all the elements of removeSet.

func (Set) RemoveSlice

func (s Set) RemoveSlice(slice []string) Set

RemoveSlice modifies s in-place to remove all the elements of slice.

func (Set) String

func (s Set) String() string

String returns a string representation of s.

func (Set) ToSlice

func (s Set) ToSlice() []string

ToSlice returns a slice representation of s.

Jump to

Keyboard shortcuts

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