You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
307 B

2 years ago
2 years ago
  1. package gentools
  2. import (
  3. "fmt"
  4. "strings"
  5. )
  6. func FmtSprintArray[T any](arr []T) []string {
  7. res := make([]string, len(arr))
  8. for i, e := range arr {
  9. res[i] = fmt.Sprint(e)
  10. }
  11. return res
  12. }
  13. func FmtSprintArrayJoin[T any](arr []T, sep string) string {
  14. return strings.Join(FmtSprintArray(arr), sep)
  15. }