GO語言"net/url"包中"QueryUnescape"函數的用法及代碼示例。
用法:
func QueryUnescape(s string)(string, error)
QueryUnescape 執行 QueryEscape 的逆變換,將 "%AB" 形式的每個 3 字節編碼子串轉換為 hex-decoded 字節 0xAB。如果任何 % 後麵沒有跟兩個十六進製數字,則返回錯誤。
例子:
package main
import (
"fmt"
"log"
"net/url"
)
func main() {
escapedQuery := "my%2Fcool%2Bblog%26about%2Cstuff"
query, err := url.QueryUnescape(escapedQuery)
if err != nil {
log.Fatal(err)
}
fmt.Println(query)
}
輸出:
my/cool+blog&about,stuff
相關用法
- GO QueryEscape用法及代碼示例
- GO QuoteRuneToGraphic用法及代碼示例
- GO QuoteRune用法及代碼示例
- GO QuoteToGraphic用法及代碼示例
- GO Quote用法及代碼示例
- GO QuoteMeta用法及代碼示例
- GO QuoteToASCII用法及代碼示例
- GO QuoteRuneToASCII用法及代碼示例
- GO PutUvarint用法及代碼示例
- GO Scanner.Scan用法及代碼示例
- GO LeadingZeros32用法及代碼示例
- GO NewFromFiles用法及代碼示例
- GO Regexp.FindString用法及代碼示例
- GO Time.Sub用法及代碼示例
- GO Regexp.FindAllIndex用法及代碼示例
- GO Encode用法及代碼示例
- GO ResponseRecorder用法及代碼示例
- GO Value用法及代碼示例
- GO StreamWriter用法及代碼示例
- GO Fscanln用法及代碼示例
注:本文由純淨天空篩選整理自golang.google.cn大神的英文原創作品 QueryUnescape。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。