Golang net/url.ParseQuery() and Get() functions example
package net/url
Golang net/url.ParseQuery() and Get() functions usage example
package main
import (
"fmt"
"net/url"
)
func main() {
// username and password must be in plain text (see below)
rawURL := "http://username:password@searchengine.com:8080/testpath/?q=socketloop.com#TestFunc"
val, err := url.ParseQuery(rawURL)
if err != nil {
panic(err)
}
fmt.Println(val.Get("http://username:password@searchengine.com:8080/testpath/?q"))
}
Output :
socketloop.com#TestFunc
References :
Advertisement
Something interesting
Tutorials
+24.5k Golang : Time slice or date sort and reverse sort example
+4.6k Javascript : Detect when console is activated and do something about it
+26.4k Golang : Convert(cast) string to uint8 type and back to string
+7.5k Golang : How to stop user from directly running an executable file?
+7.1k Golang : Squaring elements in array
+8.2k Prevent Write failed: Broken pipe problem during ssh session with screen command
+8.6k Golang : Set or add headers for many or different handlers
+32.7k Golang : Regular Expression for alphanumeric and underscore
+14.6k Golang : GUI with Qt and OpenCV to capture image from camera
+16k Golang : Generate universally unique identifier(UUID) example
+5.9k Golang : Generate multiplication table from an integer example