Standard library / net/url
url.QueryEscape()
Escape a query value; spaces become plus signs. Expected stdout: 'a%2Bb+c\n'.
Formal Syntax & Structure
go syntaxgo
func QueryEscape(s string) stringParameters & Attributes
| Name | Type | Description |
|---|---|---|
| s | string | Text to escape, unescape or canonicalize. |
Return Value
string
Operation result; check errors and validity indicators when returned.
Working Example
Example Snippetgo
package main
import ( "fmt" "net/url")
func main() { fmt.Println(url.QueryEscape("a+b 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) }}