strhlp

package
v0.46.0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Filter added in v0.17.0

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

Filter will run the function for every entry of the slice and will return a new slice with the entries that return true when used on the function

func InSlice added in v0.42.0

func InSlice(needle string, list []string) bool

InSlice will return true if the needle is one of the values in list

func ListForHumans added in v0.38.0

func ListForHumans(s []string) string

ListForHumans returns a string listing the strings from the parameter

Example: ListForHumans([]string{"one", "two", "three"}) will output: "one, two and three"

func Map added in v0.17.0

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

Map will apply the map function provided on every entry of the string slice and return a slice with the changes

func Normalize

func Normalize(s string) string

Normalize a string removes all non-english characters and lower case the string to help compare it with other strings

func PadSpace added in v0.38.0

func PadSpace(s string, size int) string

PadSpace will add spaces to the end of a string until it reaches the size set at the second parameter

func Search(s string, list []string) int

Search will search for a exact match of the string on the slide provided and if found will return its index position, or -1 if not

func Unique added in v0.24.0

func Unique(ss []string) []string

Unique will remove all duplicated strings from the slice

Types

This section is empty.

Jump to

Keyboard shortcuts

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