Slice

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2025 License: BSL-1.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains deprecated

func Contains[T comparable](s []T, e T) bool

Contains searches for an element in a slice and returns true if found Source: https://stackoverflow.com/a/70802740/5516320

Deprecated: As of Go 1.21, you can use the stdlib slices package, which was promoted from the experimental package: https://stackoverflow.com/a/71181131/5516320

This makes this function redundant, instead use slices.Contains()

func RandomStrings added in v0.5.9

func RandomStrings(length int) []string

RandomStrings generates a slice of random strings with the given length. The strings are generated by Str.Random. The length of each string is increasing by (i+1/2) with i being the passed length.

func RandomStringsLen added in v0.5.9

func RandomStringsLen(lenSlice, lenString int) []string

RandomStringsLen generates a slice of strings with the given length lenSlice. The strings are generated by Str.Random. The length of each string is defined by the passed lenString. This makes it possible to generate a slice of letters: Example: RandomStringsLen(5, 1) -> ["a", "c", "e", "g", "i"] or a slice of strings with the same length: Example: RandomStringsLen(5, 3) -> ["gea", "brv", "pgd", "qwo", "cie"]

func RemoveElement added in v0.6.0

func RemoveElement[T comparable](s []T, e T) []T

func RemoveIndex added in v0.6.0

func RemoveIndex[T comparable](s []T, idx int) []T

Types

This section is empty.

Jump to

Keyboard shortcuts

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