Answers for "Go replace all occurrences of a substring with another one"

Go
0

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)
}
Posted by: Guest on March-25-2021

Code answers related to "Go replace all occurrences of a substring with another one"

Browse Popular Code Answers by Language