til/Development/Go/strings.md

264 B

strings

Replace list of strings by using Replacer:

template := "My city is {city} and my country is {country}"
r := strings.NewReplacer("{city}", "Sai Gon", "{country}", "Viet Nam")
fmt.Println(r.Replace(template))