strings

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2019 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Copy

func Copy(src []string) (dst []string)

Copy returns a shallow copy of the source slice.

func SliceOfSlice

func SliceOfSlice(slices ...[]string) (sos [][]string)

func SortReverseStable

func SortReverseStable(s []string)

func SortStable

func SortStable(s []string)

func TruncateAppendHint

func TruncateAppendHint(s string, max int, hint string) string

Truncate returns the string with a maximum length enforced and optional appended hint (e.g. "...").

The truncate string and hint will fit inside the maximum length if possible.

func TruncatePrependHint

func TruncatePrependHint(s string, max int, hint string) string

Truncate returns the string with a maximum length enforced and optional prepended hint (e.g. "...").

The truncate string and hint will fit inside the maximum length if possible.

Types

type Set

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

func NewSet

func NewSet() *Set

NewSet returns an initialized Set.

It returns a pointer to support use as a map's value type and avoid the "cannot call pointer method" error.

func (*Set) Add

func (s *Set) Add(el string) bool

func (*Set) AddSet

func (s *Set) AddSet(other *Set)

func (*Set) AddSlice

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

func (*Set) Clear

func (s *Set) Clear()

func (*Set) Contains

func (s *Set) Contains(el string) bool

func (*Set) Copy

func (s *Set) Copy() *Set

func (*Set) Diff

func (s *Set) Diff(other *Set) *Set

Diff returns the strings found in this Set but not in the other Set.

func (*Set) Equals

func (s *Set) Equals(other *Set) bool

func (*Set) Len

func (s *Set) Len() int

func (*Set) Remove

func (s *Set) Remove(el string) bool

func (*Set) Slice

func (s *Set) Slice() []string

func (*Set) SortedReverseSlice

func (s *Set) SortedReverseSlice() []string

func (*Set) SortedSlice

func (s *Set) SortedSlice() []string

Jump to

Keyboard shortcuts

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