golang replace string
package main
import (
"fmt"
"strings"
)
func main() {
// Sample string
inputString := "Hello, world! Hello, Golang!"
// String to be replaced
oldSubstring := "Hello"
// Replacement string
newSubstring := "Hi"
// Perform string replacement
outputString := strings.Replace(inputString, oldSubstring, newSubstring, -1)
// Print the result
fmt.Println(outputString)
}