stringset

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: May 1, 2020 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StringSet

type StringSet []string

StringSet defines a collection of strings and provides useful functions to work with.

func New

func New(parts ...string) *StringSet

New creates a new stringSet. Insert the parts (strings) to the stringSet as parameter 'parts'.

func (*StringSet) AllContains

func (r *StringSet) AllContains(substr string) bool

AllContains returns true, when all strings contain the parameter 'substr'.

func (*StringSet) AllPrefix

func (r *StringSet) AllPrefix(prefix string) bool

AllPrefix returns true, when all strings have the parameter 'prefix' as prefix.

func (*StringSet) AllSuffix

func (r *StringSet) AllSuffix(suffix string) bool

AllSuffix returns true, when all strings have the parameter 'suffix' as suffix.

func (*StringSet) AnyContains

func (r *StringSet) AnyContains(substr string) bool

AnyContains returns true, when any string exists, which contains the parameter 'substr'.

func (*StringSet) AnyPrefix

func (r *StringSet) AnyPrefix(prefix string) bool

AnyPrefix returns true, when any string exists, which has the parameter 'prefix' as prefix.

func (*StringSet) AnySuffix

func (r *StringSet) AnySuffix(suffix string) bool

AnySuffix returns true, when any string exists, which has the parameter 'suffix' as suffix.

func (*StringSet) Append

func (r *StringSet) Append(parts ...string) *StringSet

Append appends strings to the stringSet.

func (*StringSet) Get

func (r *StringSet) Get(pos int) string

Get returns the part at the position 'pos'. If 'pos' is invalid, it returns an empty string.

func (*StringSet) Has

func (r *StringSet) Has(part string) bool

Has returns true, when the stringSet contains 'part'.

func (*StringSet) Join

func (r *StringSet) Join(glue string) *StringSet

Join joins all parts together with 'glue' between. The result is a stringSet with only one string.

func (*StringSet) Length

func (r *StringSet) Length() int

Length returns the length of the first contained string.

func (*StringSet) Lengths

func (r *StringSet) Lengths() []int

Lengths returns a list of lengths of the strings.

func (*StringSet) Prepend

func (r *StringSet) Prepend(parts ...string) *StringSet

Prepend prepends strings to the stringSet.

func (*StringSet) RemoveEmpty

func (r *StringSet) RemoveEmpty() *StringSet

RemoveEmpty removes all empty strings of the stringSet.

func (*StringSet) Size

func (r *StringSet) Size() int

Size returns how many strings are stored in the stringSet.

func (*StringSet) Split

func (r *StringSet) Split(separator string) *StringSet

Split splits all parts of the stringSet and adds them to the stringSet. E.g. if you have a,b and c,d and split by ",", you will have the four strings a, b, c and d in your stringSet.

func (*StringSet) String

func (r *StringSet) String() string

String returns the first string of the stringSet.

func (*StringSet) Strings

func (r *StringSet) Strings() []string

Strings is a convenient method for converting the stringSet to a string slice.

Jump to

Keyboard shortcuts

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