Standard library / html/template
html/template.HTMLEscapeString()
Returns a string with HTML special characters escaped. Expected stdout: '<b>&\n'.
Formal Syntax & Structure
go syntaxgo
func HTMLEscapeString(s string) stringParameters & Attributes
| Name | Type | Description |
|---|---|---|
| s | string | String to escape. |
Return Value
string
Returns a string with HTML special characters escaped.
Working Example
Example Snippetgo
package main
import ( "fmt" "html/template")
func main() { fmt.Println(template.HTMLEscapeString("<b>&")) }