slice

package
v3.16.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainsString

func ContainsString(s string, slice []string, modifier func(s string) string) bool

ContainsString checks if a given slice of strings contains the provided string. If a modifier func is provided, it is called with the slice item before the comparation.

     haystack := []string{"one", "Two", "Three"}
	if slice.ContainsString(haystack, "two", strings.ToLower) {
		// Do thing
	}

func ContainsStringEqualFold added in v3.11.0

func ContainsStringEqualFold(s string, slice []string) bool

ContainsStringEqualFold checks if a given slice of strings contains the provided string as ignore the cases.

 haystack := []string{"aa", "bb", "Cc"}
	if slice.ContainsStringEqualFold(haystack, "cC") {
		// Do thing
	}

Types

This section is empty.

Jump to

Keyboard shortcuts

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