Vá substituir a string
fmt.Println(strings.ReplaceAll("hello wordl", "l", "L"))
fmt.Println(strings.Replace("hello wordl", "l", "L", 3))
Restu Wahyu Saputra
fmt.Println(strings.ReplaceAll("hello wordl", "l", "L"))
fmt.Println(strings.Replace("hello wordl", "l", "L", 3))
fmt.Println(strings.ReplaceAll("hello wordl", "l", "L"))
fmt.Println(strings.Replace("hello wordl", "l", "L", 3))
// Program using Replace() to replace strings
package main
import (
"fmt"
"strings"
)
func main() {
text := "car"
fmt.Println("Old String:", text)
// replace r with t
replacedText := strings.Replace(text, "r", "t", 1)
fmt.Println("New String:", replacedText)
}