normalizeExtensions trims and lowercases each extension and ensures it starts with a dot.
(in []string)
| 280 | // normalizeExtensions trims and lowercases each extension and ensures it |
| 281 | // starts with a dot. |
| 282 | func normalizeExtensions(in []string) []string { |
| 283 | if len(in) == 0 { |
| 284 | return nil |
| 285 | } |
| 286 | out := make([]string, 0, len(in)) |
| 287 | for _, s := range in { |
| 288 | if s == "" { |
| 289 | continue |
| 290 | } |
| 291 | // strings.ToLower without importing strings: manual cast. |
| 292 | b := []byte(s) |
| 293 | for i, c := range b { |
| 294 | if c >= 'A' && c <= 'Z' { |
| 295 | b[i] = c + 32 |
| 296 | } |
| 297 | } |
| 298 | s = string(b) |
| 299 | if s[0] != '.' { |
| 300 | s = "." + s |
| 301 | } |
| 302 | out = append(out, s) |
| 303 | } |
| 304 | return out |
| 305 | } |
no outgoing calls