Golang net/url.QueryEscape() function examples
package net/url
Golang net/url.QueryEscape() function usage examples
Example 1 :
var postStr string = paypal_url + "&cmd=_notify-validate&"
for k, v := range r.Form {
fmt.Println("key :", k)
fmt.Println("value :", strings.Join(v, ""))
// NOTE : Store the IPN data k,v into a slice. It will be useful for database entry later.
postStr = postStr + k + "=" + url.QueryEscape(strings.Join(v, "")) + "&"
}
Example 2 :
func TagSearch(tag string) string {
return fmt.Sprintf("https://example.com/search?q=%s", url.QueryEscape(tag))
}
References :
Advertisement
Something interesting
Tutorials
+27.2k Golang : Find files by name - cross platform example
+17k Golang : Capture stdout of a child process and act according to the result
+15.6k Golang : Force download file example
+4.6k JavaScript : Rounding number to decimal formats to display currency
+17.9k Golang : How to make a file read only and set it to writable again?
+16.3k Golang : Find out mime type from bytes in buffer
+8.3k Useful methods to access blocked websites
+7.3k Golang : Fixing Gorilla mux http.FileServer() 404 problem
+20.8k Golang : Underscore or snake_case to camel case example
+41.9k Golang : How do I convert int to uint8?
+11.3k Golang : Byte format example
+19.1k Mac OSX : Homebrew and Golang