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: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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.

Source Files

  • slice.go
  • string.go

Jump to

Keyboard shortcuts

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