Standard library / net/url

url.QueryUnescape()

Decode percent escapes and plus signs in a query value. Expected stdout: 'a+b c\n'.

Formal Syntax & Structure

go syntaxgo
func QueryUnescape(s string) (string, error)

Parameters & Attributes

NameTypeDescription
sstringText to escape, unescape or canonicalize.

Return Value

(string, error)

Operation result; check errors and validity indicators when returned.

Working Example

Example Snippetgo
package main
import (  "fmt"  "net/url")
func main() { fmt.Println(must(url.QueryUnescape("a%2Bb+c"))) }
func must[T any](v T, e error) T {  if e != nil {    panic(e)  }  return v}func check(e error) {  if e != nil {    panic(e)  }}
Go Reference