Golang encoding/xml.Escape() function example
package encoding/xml
Escape is like EscapeText but omits the error return value. It is provided for backwards compatibility with Go 1.0. Code targeting Go 1.1 or later should use EscapeText.
Golang encoding/xml.Escape() function usage example
package main
import (
"encoding/xml"
"os"
)
func main() {
str := "\"'&<>"
xml.Escape(os.Stdout, []byte(str))
}
Output :
" '&<>
Reference :
Advertisement
Something interesting
Tutorials
+8.5k Golang : How to check variable or object type during runtime?
+12.1k Golang : Perform sanity checks on filename example
+20.2k Golang : Compare floating-point numbers
+44.9k Golang : Use wildcard patterns with filepath.Glob() example
+10.4k Golang : Simple Jawi(Yawi) to Rumi(Latin/Romanize) converter
+22.4k Golang : How to read JPG(JPEG), GIF and PNG files ?
+15.3k nginx: [emerg] unknown directive "ssl"
+3.7k Golang : Switch Redis database redis.NewClient
+18.6k Golang : Get download file size
+18.7k Unmarshal/Load CSV record into struct in Go
+10.3k Golang : Convert file content to Hex
+35.5k Golang : Smarter Error Handling with strings.Contains()