Import the strings package
import "strings"
func Replace(s, old, new string, n int) string
In the s string, replace the old string with the new string, n represents the number of replacements, and less than 0 represents all replacements
//替换两次
fmt.Println(strings.Replace("oink oink oink", "k", "ky", 2))
//全部替换
fmt.Println(strings.Replace("oink oink oink", "oink", "moo", -1))
// output result
oinky oinky oink
moo moo moo