strings

package
v5.10.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2019 License: MIT, MIT, MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FoundInArray

func FoundInArray(item string, array []string) bool

FoundInArray searches array for item without distinguishing between uppercase and lowercase and non-alphanumeric characters. Returns true if item is a value of array

func InArray

func InArray(item string, array []string) bool

InArray searches 'array' for 'item' string Returns true 'item' is a value of 'array'

func Intersect

func Intersect(a []string, b []string) []string

Intersect finds the intersection between two slices of strings.

func OccurrencesOf

func OccurrencesOf(s string, in []string) int

OccurrencesOf returns the number of times a string appears in the given slice of strings.

func Remove

func Remove(item string, array []string) []string

Remove searches 'array' for 'item' string and removes the string if found

Types

type OccurrenceSet

type OccurrenceSet map[string]int

OccurrenceSet captures of occurrences of string values.

func NewOccurrenceSet

func NewOccurrenceSet(s ...string) OccurrenceSet

NewOccurrenceSet returns new instance of OccurrenceSet.

func (OccurrenceSet) Add

func (o OccurrenceSet) Add(ss ...string)

Add entry and increment count

func (OccurrenceSet) Get

func (o OccurrenceSet) Get(entry string) int

Get returns occurrences of given string

func (OccurrenceSet) Merge

func (o OccurrenceSet) Merge(b OccurrenceSet)

Merge given set of occurrences

func (OccurrenceSet) Remove

func (o OccurrenceSet) Remove(ss ...string)

Remove items from set

func (OccurrenceSet) Size

func (o OccurrenceSet) Size() int

Size of values tracked

func (OccurrenceSet) Values

func (o OccurrenceSet) Values() []string

Values returns all occurrences

Jump to

Keyboard shortcuts

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