GO語言"net/url"包中"PathUnescape"函數的用法及代碼示例。
用法:
func PathUnescape(s string)(string, error)
PathUnescape 執行 PathEscape 的逆變換,將 "%AB" 形式的每個 3 字節編碼子串轉換為 hex-decoded 字節 0xAB。如果任何 % 後麵沒有跟兩個十六進製數字,則返回錯誤。
PathUnescape 與 QueryUnescape 相同,隻是它不會將 '+' 轉義到“ ”(空格)。
例子:
package main
import (
"fmt"
"log"
"net/url"
)
func main() {
escapedPath := "my%2Fcool+blog&about%2Cstuff"
path, err := url.PathUnescape(escapedPath)
if err != nil {
log.Fatal(err)
}
fmt.Println(path)
}
輸出:
my/cool+blog&about,stuff
相關用法
- GO PathEscape用法及代碼示例
- GO ParseAddress用法及代碼示例
- GO ParseUint用法及代碼示例
- GO ParseIP用法及代碼示例
- GO ParseMediaType用法及代碼示例
- GO ParseInt用法及代碼示例
- GO ParseCIDR用法及代碼示例
- GO ParseInLocation用法及代碼示例
- GO ParseDuration用法及代碼示例
- GO ParseFile用法及代碼示例
- GO Parse用法及代碼示例
- GO ParseAddressList用法及代碼示例
- GO ParseBool用法及代碼示例
- GO ParseQuery用法及代碼示例
- GO ParseFloat用法及代碼示例
- GO ParsePKIXPublicKey用法及代碼示例
- GO PutUvarint用法及代碼示例
- GO PlainAuth用法及代碼示例
- GO Print用法及代碼示例
- GO Pow10用法及代碼示例
注:本文由純淨天空篩選整理自golang.google.cn大神的英文原創作品 PathUnescape。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。