replace substring golang code example
Example: Go replace all occurrences of a substring with another one
import (
"fmt"
"strings"
)
func main() {
value := "The quick brown fox jumps over the lazy dog"
// Replace the "fox" with a "horse."
result := strings.Replace(value, "fox", "horse", -1)
fmt.Println(result)
}