mirror of
https://github.com/Jinnrry/PMail.git
synced 2025-10-29 11:02:37 +08:00
first commit
This commit is contained in:
19
server/utils/array/array.go
Normal file
19
server/utils/array/array.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package array
|
||||
|
||||
import (
|
||||
"github.com/spf13/cast"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func Join[T any](arg []T, str string) string {
|
||||
var ret strings.Builder
|
||||
for i, t := range arg {
|
||||
if i == 0 {
|
||||
ret.WriteString(cast.ToString(t))
|
||||
} else {
|
||||
ret.WriteString(str)
|
||||
ret.WriteString(cast.ToString(t))
|
||||
}
|
||||
}
|
||||
return ret.String()
|
||||
}
|
||||
Reference in New Issue
Block a user