github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/updater/util/strings.go (about) 1 // Copyright 2015 Keybase, Inc. All rights reserved. Use of 2 // this source code is governed by the included BSD license. 3 4 package util 5 6 import "strings" 7 8 // JoinPredicate joins strings with predicate 9 func JoinPredicate(arr []string, delimeter string, f func(s string) bool) string { 10 arrNew := make([]string, 0, len(arr)) 11 for _, s := range arr { 12 if f(s) { 13 arrNew = append(arrNew, s) 14 } 15 } 16 return strings.Join(arrNew, delimeter) 17 }