ResolvePlaceholderString populates a template with values
(str string, arguments map[string]string)
| 22 | |
| 23 | // ResolvePlaceholderString populates a template with values |
| 24 | func ResolvePlaceholderString(str string, arguments map[string]string) string { |
| 25 | oldnews := make([]string, 0, len(arguments)*4) |
| 26 | for key, value := range arguments { |
| 27 | oldnews = append(oldnews, |
| 28 | "{{"+key+"}}", value, |
| 29 | "{{."+key+"}}", value, |
| 30 | ) |
| 31 | } |
| 32 | return strings.NewReplacer(oldnews...).Replace(str) |
| 33 | } |