strings

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2022 License: Apache-2.0 Imports: 3 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StringHandler

type StringHandler func(string) error

func With

With starts a new StringHandler

func (StringHandler) Do

func (a StringHandler) Do(s string) error

Do invokes a StringHandler with a specific string

func (StringHandler) Then

Then joins two string handlers so the left-hand side runs first then the right-hand side.

type StringSlice

type StringSlice []string

func Of

func Of(s ...string) StringSlice

Of returns a StringSlice from a slice of strings

func (StringSlice) ForEach

func (s StringSlice) ForEach(f StringHandler) error

ForEach invokes a StringHandler for each entry in a StringSlice. First one to return an error terminates the loop.

func (StringSlice) IsEmpty

func (s StringSlice) IsEmpty() bool

IsEmpty returns true if a StringSlice has no entries

func (StringSlice) Join

func (s StringSlice) Join(sep string) string

Join returns the content of a StringSlice with the specified separator between each entry

func (StringSlice) Join2

func (s StringSlice) Join2(prefix, suffix, sep string) string

Join2 is similar to Join except it adds the prefix & suffix to the final result

func (StringSlice) Sort

func (s StringSlice) Sort() StringSlice

Sort sorts the string slice using a case-insensitive comparator.

func (StringSlice) Write

func (s StringSlice) Write(w io.Writer) error

Write will write a StringSlice to a writer with each entry being a single line.

type StringSliceHandler

type StringSliceHandler func(StringSlice) (StringSlice, error)

func (StringSliceHandler) Do

func (StringSliceHandler) Then

Jump to

Keyboard shortcuts

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