Documentation
¶
Overview ¶
htmlパッケージは、HTMLテキストのエスケープとアンエスケープのための関数を提供します。
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EscapeString ¶
EscapeStringは"<"のような特殊文字を"<"にエスケープします。 エスケープするのは5つの文字のみです:<、>、&、'、"。 UnescapeString(EscapeString(s)) == sは常に成り立ちますが、逆は常に真ではありません。
Example ¶
package main
import (
"github.com/shogo82148/std/fmt"
"github.com/shogo82148/std/html"
)
func main() {
const s = `"Fran & Freddie's Diner" <tasty@example.com>`
fmt.Println(html.EscapeString(s))
}
Output: "Fran & Freddie's Diner" <tasty@example.com>
func UnescapeString ¶
UnescapeStringは"<"のようなエンティティを"<"にアンエスケープします。 [EscapeString]がエスケープするよりも広範囲のエンティティをアンエスケープします。 たとえば、"á"は"á"にアンエスケープされ、"á"や"á"も同様です。 UnescapeString(EscapeString(s)) == sは常に成り立ちますが、逆は常に真ではありません。
Example ¶
package main
import (
"github.com/shogo82148/std/fmt"
"github.com/shogo82148/std/html"
)
func main() {
const s = `"Fran & Freddie's Diner" <tasty@example.com>`
fmt.Println(html.UnescapeString(s))
}
Output: "Fran & Freddie's Diner" <tasty@example.com>
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.