collection

package
v1.79.0 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

* Copyright (C) 2020-2022 Arm Limited or its affiliates and Contributors. All rights reserved. * SPDX-License-Identifier: Apache-2.0

* Copyright (C) 2020-2022 Arm Limited or its affiliates and Contributors. All rights reserved. * SPDX-License-Identifier: Apache-2.0

* Copyright (C) 2020-2022 Arm Limited or its affiliates and Contributors. All rights reserved. * SPDX-License-Identifier: Apache-2.0

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func All

func All(slice []bool) bool

All returns true if all items of the slice are true.

func AllFunc added in v1.78.0

func AllFunc[S ~[]E, E any](s S, f func(E) bool) bool

AllFunc returns whether f returns true for all the elements of slice s.

func AllNotEmpty added in v1.49.0

func AllNotEmpty(strict bool, slice []string) bool

AllNotEmpty returns whether all elements of the slice are not empty. If strict, then whitespaces are considered as empty strings

func AllTrue added in v1.78.0

func AllTrue(values ...bool) bool

AllTrue returns whether all values are true.

func Any

func Any(slice []bool) bool

Any returns true if there is at least one element of the slice which is true.

func AnyEmpty added in v1.49.0

func AnyEmpty(strict bool, slice []string) bool

AnyEmpty returns whether there is one entry in the slice which is empty. If strict, then whitespaces are considered as empty strings

func AnyFunc added in v1.78.0

func AnyFunc[S ~[]E, E any](s S, f func(E) bool) bool

AnyFunc returns whether there is at least one element of slice s for which f() returns true.

func AnyTrue added in v1.78.0

func AnyTrue(values ...bool) bool

AnyTrue returns whether there is a value set to true

func Find

func Find(slice *[]string, val string) (int, bool)

Find looks for an element in a slice. If found it will return its index and true; otherwise it will return -1 and false.

func FindInSlice added in v1.49.0

func FindInSlice(strict bool, slice []string, val ...string) (int, bool)

FindInSlice finds if any values val are present in the slice and if so returns the first index. if strict, it checks for an exact match; otherwise it discards whitespaces and case.

func GenericRemove added in v1.4.0

func GenericRemove(equal func(string, string) bool, slice []string, val ...string) []string

GenericRemove looks for elements in a slice using the equal function. If they're found, it will remove them from the slice.

func ParseCommaSeparatedList

func ParseCommaSeparatedList(input string) []string

ParseCommaSeparatedList returns the list of string separated by a comma

func ParseCommaSeparatedListToMap added in v1.71.0

func ParseCommaSeparatedListToMap(input string) (pairs map[string]string, err error)

ParseCommaSeparatedListToMap returns a map of key value pairs from a string containing a comma separated list

func ParseListWithCleanup added in v1.9.0

func ParseListWithCleanup(input string, sep string) (newS []string)

ParseListWithCleanup splits a string into a list like strings.Split but also removes any whitespace surrounding the different items for example, ParseListWithCleanup("a, b , c", ",") returns []{"a","b","c"}

func ParseListWithCleanupKeepBlankLines added in v1.12.0

func ParseListWithCleanupKeepBlankLines(input string, sep string) (newS []string)

ParseListWithCleanupKeepBlankLines splits a string into a list like strings.Split but also removes any whitespace surrounding the different items unless the entire item is whitespace in which case it is converted to an empty string. For example, ParseListWithCleanupKeepBlankLines("a, b , c", ",") returns []{"a","b","c"} ParseListWithCleanupKeepBlankLines("a, b , , c", ",") returns []{"a","b", "", "c"}

func Remove added in v1.4.0

func Remove(slice []string, val ...string) []string

Remove looks for elements in a slice. If they're found, it will remove them.

func UniqueEntries added in v1.75.0

func UniqueEntries[T comparable](slice []T) []T

UniqueEntries returns all the unique values contained in a slice.

Types

This section is empty.

Directories

Path Synopsis
Package pagination provides a ways to iterate over collections.
Package pagination provides a ways to iterate over collections.

Jump to

Keyboard shortcuts

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