Documentation
¶
Overview ¶
Package utils provides various utility functions for string manipulation, color conversion, and slice operations.
Index ¶
- func ContainsDigits(s string) bool
- func HSVToRGB(h, s, v float64) (int32, int32, int32)
- func IntersectionSlices[T constraints.Ordered](a, b []T) []T
- func MostOcc[T comparable](items []T) T
- func OnlyContainsDigits(s string) bool
- func RandomString(base string) (string, error)
- func ReverseSlice[T any](s []T)
- func ShortenString(s string, l int) string
- func SliceEquals[T constraints.Ordered](a, b []T) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainsDigits ¶ added in v0.4.6
ContainsDigits checks if a string contains any digit characters.
func IntersectionSlices ¶ added in v0.4.9
func IntersectionSlices[T constraints.Ordered](a, b []T) []T
IntersectionSlices returns the intersection of two slices.
func MostOcc ¶ added in v0.4.6
func MostOcc[T comparable](items []T) T
MostOcc returns the most occurring element in a slice of comparable elements.
func OnlyContainsDigits ¶ added in v0.4.6
OnlyContainsDigits checks if a string contains only digit characters.
func RandomString ¶ added in v0.5.34
RandomString generates a random string prepended with a base string.
func ReverseSlice ¶ added in v0.4.9
func ReverseSlice[T any](s []T)
ReverseSlice reverses a slice in place.
func ShortenString ¶ added in v0.2.11
ShortenString shortens a string to a given length and appends "..." if it exceeds that length.
func SliceEquals ¶ added in v0.4.9
func SliceEquals[T constraints.Ordered](a, b []T) bool
SliceEquals checks if two slices are equal, ignoring order.
Types ¶
This section is empty.