JoinStringsMap maps contents of xs to strings using f and joins them with sep.
(f func(k any, v any) string, sep string, xs any)
| 126 | |
| 127 | // JoinStringsMap maps contents of xs to strings using f and joins them with sep. |
| 128 | func JoinStringsMap(f func(k any, v any) string, sep string, xs any) string { |
| 129 | r, ok := WrapRanger(xs) |
| 130 | if !ok { |
| 131 | panic(fmt.Sprintf("cannot range over values of type %T", xs)) |
| 132 | } |
| 133 | var ss []string |
| 134 | r.Range(func(k, v any) bool { |
| 135 | ss = append(ss, f(k, v)) |
| 136 | return true |
| 137 | }) |
| 138 | return strings.Join(ss, sep) |
| 139 | } |
| 140 | |
| 141 | // JoinStringsf formats contents of xs using format and joins them with sep. |
| 142 | func JoinStringsf(format, sep string, withKeys bool, xs any) string { |