parseStringSlice parses a comma-separated list of strings, trimming whitespace from each element.
(env string)
| 71 | |
| 72 | // parseStringSlice parses a comma-separated list of strings, trimming whitespace from each element. |
| 73 | func parseStringSlice(env string) ([]string, error) { |
| 74 | parts := strings.Split(env, ",") |
| 75 | result := make([]string, len(parts)) |
| 76 | for i, p := range parts { |
| 77 | result[i] = strings.TrimSpace(p) |
| 78 | } |
| 79 | return result, nil |
| 80 | } |
| 81 | |
| 82 | // parseStringSliceSep returns a parser that splits by a custom separator. |
| 83 | // The separator is obtained from the provided StringVar descriptor. |