, &, ' and ". UnescapeString(EscapeString(s)) == s always holds, but the converse isn't always true." /> , &, ' and ". UnescapeString(EscapeString(s)) == s always holds, but the converse isn't always true." />

EscapeString in Go

Posted by GoDoc
Public (Editable by Users)

EscapeString escapes special characters like "<" to become "<". It escapes only five such characters: <, >, &, ' and ". UnescapeString(EscapeString(s)) == s always holds, but the converse isn't always true.

Go
Edit
package main

import (
	"fmt"
	"html"
)

func main() {
	const s = `"Fran & Freddie's Diner" <tasty@example.com>`
	fmt.Println(html.EscapeString(s))
}