I am getting a physical location address from a user and trying to arrange it to create a URL that would use later to get a JSON response from Google Geocode API.
Th
If you need to replace all occurrences of the character in the string, then use strings.ReplaceAll:
package main import ( "fmt" "strings" ) func main() { str := "a space-separated string" str = strings.ReplaceAll(str, " ", ",") fmt.Println(str) }