ToStrings works for any type where the base type is a string.
(a []T)
| 25 | |
| 26 | // ToStrings works for any type where the base type is a string. |
| 27 | func ToStrings[T ~string](a []T) []string { |
| 28 | tmp := make([]string, 0, len(a)) |
| 29 | for _, v := range a { |
| 30 | tmp = append(tmp, string(v)) |
| 31 | } |
| 32 | return tmp |
| 33 | } |
| 34 | |
| 35 | func StringEnums[E ~string](a []string) []E { |
| 36 | if a == nil { |
no outgoing calls
no test coverage detected