stringutils

package
v1.4.8 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2017 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendIfAbsent

func AppendIfAbsent(strings []string, s string) []string

AppendIfAbsent appends a string to a slice, given that the string is not yet present in the slice

func Contract

func Contract(m map[string]string, f func(string, string) string) []string

Contract takes a map[string]string and condition contracts pairs of key and values.

func DefaultIf

func DefaultIf(value, defaultValue, condition string) string

DefaultIf falls back to a default value if the passed value is equal to the condition parameter.

func DefaultIfEmpty

func DefaultIfEmpty(value, defaultValue string) string

DefaultIfEmpty falls back to a default value if the passed value is empty

func ErrorMessages

func ErrorMessages(errs []error) []string

ErrorMessages accumulates the error messages from s lice of errors.

func Filter

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

Filter takes a slice of strings and returns a slice of strings consisting of those strings from the input for which the filter evaluated to true.

func IsAbsent

func IsAbsent(strings []string, s string) bool

IsAbsent returns true if a given string is not contained in a given slice.

func Quote

func Quote(s []string) []string

Quote takes a slice of strings and returns a slice of strings where each element of the input is put in double quotation marks.

func StringKeys

func StringKeys(m map[string]string) []string

StringKeys extracts the key of a map[string]string and returns them as a slice of strings.

func StringValues

func StringValues(m map[string]string) []string

StringValues extracts the values of a map[string]string and returns them as a slice of strings.

func Transform

func Transform(s []string, f func(string) string) []string

Transform takes a slice of strings, transforms each element and returns a slice of strings containing the transformed values

Types

This section is empty.

Jump to

Keyboard shortcuts

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