go-util/join.go

16 lines
266 B
Go
Raw Normal View History

2023-08-28 19:47:36 +00:00
package util
// join with sep if arg is not empty
func JoinWithSep(sep string, args ...string) (result string) {
// l := len(args)
for i, v := range args {
if v != "" {
if i > 0 {
result = result + sep
}
result = result + v
}
}
return result
}