GO語言"html"包中"UnescapeString"函數的用法及代碼示例。
用法:
func UnescapeString(s string) string
UnescapeString 將 "<" 等實體轉義為 "<"。它比 EscapeString 轉義的實體範圍更大。例如,"á" 轉義為 "á","á" 和 "á" 也是如此。 UnescapeString(EscapeString(s)) == s 總是成立,但反之亦然。
例子:
package main
import (
"fmt"
"html"
)
func main() {
const s = `"Fran & Freddie's Diner" <tasty@example.com>`
fmt.Println(html.UnescapeString(s))
}
輸出:
"Fran & Freddie's Diner" <tasty@example.com>
相關用法
- GO Unmarshal用法及代碼示例
- GO UnaryOp用法及代碼示例
- GO Unsetenv用法及代碼示例
- GO Unquote用法及代碼示例
- GO Unwrap用法及代碼示例
- GO UnquoteChar用法及代碼示例
- GO UnixMilli用法及代碼示例
- GO Unix用法及代碼示例
- GO UnixMicro用法及代碼示例
- GO UDPConn.WriteTo用法及代碼示例
- GO URL.Hostname用法及代碼示例
- GO URL.EscapedPath用法及代碼示例
- GO URL.Port用法及代碼示例
- GO URL.ResolveReference用法及代碼示例
- GO URL.Query用法及代碼示例
- GO URL.Redacted用法及代碼示例
- GO URL.Parse用法及代碼示例
- GO URL.String用法及代碼示例
- GO URL.UnmarshalBinary用法及代碼示例
- GO URL.EscapedFragment用法及代碼示例
注:本文由純淨天空篩選整理自golang.google.cn大神的英文原創作品 UnescapeString。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。