-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Open
Description
Proposal Details
I propose the addition of:
// Trim returns a slice with all leading and trailing elements of s contained in v removed.
func Trim[S ~[]E, E comparable](s S, v ...E) S
// TrimLeft returns a slice with all leading elements of s contained in v removed.
func TrimLeft[S ~[]E, E comparable](s S, v ...E) S
// TrimRight returns a slice with all trailing elements of s contained in v removed.
func TrimRight[S ~[]E, E comparable](s S, v ...E) S
// TrimFunc returns a slice with all leading and trailing elements of s that satisfy f removed.
func TrimFunc[S ~[]E, E any](s S, f func(E) bool) bool
// TrimLeftFunc returns a slice with all leading elements of s that satisfy f removed.
func TrimLeftFunc[S ~[]E, E any](s S, f func(E) bool) bool
// TrimRightFunc returns a slice with all trailing elements of s that satisfy f removed.
func TrimRightFunc[S ~[]E, E any](s S, f func(E) bool) boolThese functions match similar functions found in the "bytes" and "strings" packages:
TrimTrimLeftTrimRightTrimFuncTrimLeftFuncTrimRightFunc
bjorndm, chad-bekmezian-snap, meling, theadell, xiaokentrl and 4 morejfrechxiaokentrlxiaokentrl
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Incoming