Golang text/template.URLQueryEscaper() function example

package text/template

Golang text/template.URLQueryEscaper() function usage example

 package main

 import (
  "fmt"
  "text/template"
 )

 func main() {

  search := "Zip Unzip"

  finalURL := "http://go-search.org/search?q=" + template.URLQueryEscaper(search)

  fmt.Println(finalURL)

 }

Output :

http://go-search.org/search?q=Zip+Unzip

Reference :

http://golang.org/pkg/text/template/#URLQueryEscaper

Advertisement