xstrings

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2023 License: MIT Imports: 2 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Join

func Join[T ~string](elems []T, sep string) string

Join concatenates the elements of its first argument to create a single string. The separator string sep is placed between elements in the resulting string.

This is a copy of Go's strings.Join but uses generic type for the elements.

func Pointer deprecated

func Pointer[T ~string](s T) *T

Pointer returns string typed s as pointer.

Deprecated: use xptr.To().

func RepeatJoin

func RepeatJoin[T ~string](s T, count int, sep string) string

RepeatJoin returns a string consisting of count copies of the string s concatenated using the separate string sep. This is similar as using RepeatSlice together with Go's strings.Join. Panics when count is negative.

func RepeatSlice

func RepeatSlice[T ~string](s T, count int) []string

RepeatSlice returns a []string consisting of count copies of the string s. When count is zero, empty slice is returned. Panics when count is out of range when making slice.

func Search[T ~string](a []T, x T) int

Search returns the position of x in slice a or -1 when x is not part of a.

func SliceHas

func SliceHas[T ~string](a []T, x T) bool

SliceHas returns true when x is found in slice a.

Types

This section is empty.

Jump to

Keyboard shortcuts

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