package
1.24.4
Repository: https://pkg.go.dev/std
Documentation: pkg.go.dev

# Functions

All returns an iterator over index-value pairs in the slice in the usual order.
AppendSeq appends the values from seq to the slice and returns the extended slice.
Backward returns an iterator over index-value pairs in the slice, traversing it backward with descending indices.
BinarySearch searches for target in a sorted slice and returns the earliest position where target is found, or the position where target would appear in the sort order; it also returns a bool saying whether the target is really found in the slice.
BinarySearchFunc works like [BinarySearch], but uses a custom comparison function.
Chunk returns an iterator over consecutive sub-slices of up to n elements of s.
Clip removes unused capacity from the slice, returning s[:len(s):len(s)].
Clone returns a copy of the slice.
Collect collects values from seq into a new slice and returns it.
Compact replaces consecutive runs of equal elements with a single copy.
CompactFunc is like [Compact] but uses an equality function to compare elements.
Compare compares the elements of s1 and s2, using [cmp.Compare] on each pair of elements.
CompareFunc is like [Compare] but uses a custom comparison function on each pair of elements.
Concat returns a new slice concatenating the passed in slices.
Contains reports whether v is present in s.
ContainsFunc reports whether at least one element e of s satisfies f(e).
Delete removes the elements s[i:j] from s, returning the modified slice.
DeleteFunc removes any elements from s for which del returns true, returning the modified slice.
Equal reports whether two slices are equal: the same length and all elements equal.
EqualFunc reports whether two slices are equal using an equality function on each pair of elements.
Grow increases the slice's capacity, if necessary, to guarantee space for another n elements.
Index returns the index of the first occurrence of v in s, or -1 if not present.
IndexFunc returns the first index i satisfying f(s[i]), or -1 if none do.
Insert inserts the values v..
IsSorted reports whether x is sorted in ascending order.
IsSortedFunc reports whether x is sorted in ascending order, with cmp as the comparison function as defined by [SortFunc].
Max returns the maximal value in x.
MaxFunc returns the maximal value in x, using cmp to compare elements.
Min returns the minimal value in x.
MinFunc returns the minimal value in x, using cmp to compare elements.
Repeat returns a new slice that repeats the provided slice the given number of times.
Replace replaces the elements s[i:j] by the given v, and returns the modified slice.
Reverse reverses the elements of the slice in place.
Sort sorts a slice of any ordered type in ascending order.
Sorted collects values from seq into a new slice, sorts the slice, and returns it.
SortedFunc collects values from seq into a new slice, sorts the slice using the comparison function, and returns it.
SortedStableFunc collects values from seq into a new slice.
SortFunc sorts the slice x in ascending order as determined by the cmp function.
SortStableFunc sorts the slice x while keeping the original order of equal elements, using cmp to compare elements in the same way as [SortFunc].
Values returns an iterator that yields the slice elements in order.