strutil

package
v1.7.7 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertKVStringsToMap

func ConvertKVStringsToMap(values []string) map[string]string

ConvertKVStringsToMap is from https://github.com/moby/moby/blob/v20.10.0-rc2/runconfig/opts/parse.go

ConvertKVStringsToMap converts ["key=value"] to {"key":"value"}

func DedupeStrSlice

func DedupeStrSlice(in []string) []string

func InStringSlice

func InStringSlice(ss []string, str string) bool

InStringSlice checks whether a string is inside a string slice. Comparison is case insensitive.

From https://github.com/containerd/containerd/blob/7c6d710bcfc81a30ac1e8cbb2e6a4c294184f7b7/pkg/cri/util/strings.go#L21-L30

func ParseBoolOrAuto added in v0.13.0

func ParseBoolOrAuto(s string) (*bool, error)

ParseBoolOrAuto returns (nil, nil) if s is "auto" https://github.com/moby/buildkit/blob/v0.9.1/cmd/buildkitd/config.go#L35-L42

func ParseCSVMap added in v0.7.3

func ParseCSVMap(s string) (map[string]string, error)

ParseCSVMap parses a string like "foo=x,bar=y" into a map

func ReverseStrSlice added in v0.13.0

func ReverseStrSlice(in []string) []string

func SliceToSet added in v1.5.0

func SliceToSet(in []string) map[string]bool

SliceToSet converts a slice of strings into a set. In Go, a set is often represented as a map with keys as the set elements and values as boolean. This function iterates over the slice, adding each string as a key in the map. The corresponding map value is set to true, serving as a placeholder. The resulting map can be used to quickly check the presence of an element in the set.

func TrimStrSliceRight added in v0.8.0

func TrimStrSliceRight(base, extra []string) []string

Types

This section is empty.

Jump to

Keyboard shortcuts

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