utils

package
v0.20.1 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains[T comparable](slice []T, item T) bool

Contains returns true if the item is in the slice

func Remove

func Remove[T comparable](slice []T, items ...T) []T

Remove an item from a slice

func StringLimiter

func StringLimiter(str string, limit int) string

StringLimiter will limit a string to a specific limit and drop rest of the string

Example:

StringLimiter("hello world", 15) => "hello world"
StringLimiter("hello world", 3) => "hell"

func StringifySlice

func StringifySlice[T fmt.Stringer](slice []T) []string

StringifySlice transform a slice of Stringer into a slice of string

func Uniq

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

Uniq returns a new slice with unique items from the given slice

Types

This section is empty.

Jump to

Keyboard shortcuts

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