stringset

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2018 License: MIT Imports: 4 Imported by: 5

README

stringset GoDoc License Build Status Coverage Status GoReportCard

Package stringset provides a string set type.

Read the package documentation for more information.

Licence

MIT

Documentation

Overview

Package stringset implements a set of strings.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Set

type Set map[string]struct{}

Set is a set of strings.

func Add

func Add(set Set, v ...string) Set

Add adds the values in v to the set and returns the set. If the set is nil, a new set is created.

func New

func New(v ...string) Set

New creates a new string set populated with the values in v.

func (*Set) Add

func (set *Set) Add(v ...string) Set

Add adds the values in v to the set. If the set is nil a new set is created. Add returns set in order to support method chaining.

func (Set) Contains

func (set Set) Contains(s string) bool

Contains returns true if the string set contains s.

func (Set) Equal

func (set Set) Equal(other Set) bool

Equal returns true if set is equal to other.

func (Set) Format

func (set Set) Format(f fmt.State, c rune)

Format implements the Formatter interface

func (Set) GoString

func (set Set) GoString() string

GoString implements the GoStringer inteface.

func (Set) Join

func (set Set) Join(sep string) string

Join concatenates the sorted elements of set to create a single string. The strings are sorted prior to concatenation. The separator string sep is placed between elements in the resulting string.

func (Set) Len

func (set Set) Len() int

Len returns the number of item in the set.

func (Set) MarshalJSON

func (set Set) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (Set) Remove

func (set Set) Remove(v ...string) Set

Remove removes the values in v from the set. Remove returns set in order to support method chaining.

func (Set) String added in v1.0.2

func (set Set) String() string

String implements the Stringer inteface.

func (*Set) UnmarshalJSON

func (set *Set) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (Set) Values

func (set Set) Values() []string

Values returns the values of the set as a slice of string. The strings are ordered in the returned slice. If the set is empty, returns nil.

Jump to

Keyboard shortcuts

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