stringslice

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2021 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package stringslice contains various functions to work with slices of strings and the strings contained within.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func All

func All(a []string, f predicate) bool

All returns true if f(s) is true for all s in a. All([], f) is true.

func Any

func Any(a []string, f func(string) bool) bool

Any (returns true if f(s) is true for any s in a. Any([], f) is false.

func AppendIfNonEmpty

func AppendIfNonEmpty(a []string, strings ...string) []string

AppendIfNonEmpty appends the given string(s) to the slice if they are not the empty string.

func Combine

func Combine(slices ...[]string) []string

Combine multiple slices into a single slice. This is equivalent to appending each slice in turn.

func Copy

func Copy(src []string) []string

Copy makes a copy of the []string.

func Filter

func Filter(a []string, f func(string) bool) []string

Filter returns the elements of a where f(a) is true.

func FilterFalse

func FilterFalse(a []string, f func(string) bool) []string

FilterFalse returns the elements of a where f(a) is false.

func IndexOf

func IndexOf(a []string, search string) (int, bool)

IndexOf returns the index of the search string

func Map

func Map(a []string, f func(string) string) []string

Map maps a function across the slice, returning a new slice containing f(s) for s in a

func NonEmpty

func NonEmpty(a []string) []string

NonEmpty returns a slice containing the non-empty elements of a

func Sorted

func Sorted(a ...string) []string

Sorted takes any number of input strings and returns a sorted stringslice.

func TotalDistance

func TotalDistance(a []string, b []string) (distance int, ok bool)

TotalDistance returns the sum of the levanshtein distance of the strings. If the string slices are not the same length, OK is false.

Types

This section is empty.

Jump to

Keyboard shortcuts

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