github.com/searKing/golang/go@v1.2.74/container/slice/dropuntil.go (about) 1 // Copyright 2020 The searKing Author. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package slice 6 7 // DropUntilFunc returns, if this slice is ordered, a slice consisting of the remaining 8 // elements of this slice after dropping the longest prefix of elements 9 // that match the given predicate. Otherwise returns, if this slice is 10 // unordered, a slice consisting of the remaining elements of this slice 11 // after dropping a subset of elements that match the given predicate. 12 func DropUntilFunc(s interface{}, f func(interface{}) bool) interface{} { 13 return normalizeSlice(dropUntilFunc(Of(s), f, true), s) 14 } 15 16 // dropUntilFunc is the same as DropUntilFunc. 17 func dropUntilFunc(s []interface{}, f func(interface{}) bool, truth bool) []interface{} { 18 return dropWhileFunc(s, f, !truth) 19 }