Standard library / strconv

strconv.AppendQuoteToASCII()

Appends ASCII-only double-quoted Go literal to dst. Returns the expanded slice; retain it even if the initial destination has enough capacity. Expected stdout: 'v="\\u00e9"\n'.

Formal Syntax & Structure

go syntaxgo
func AppendQuoteToASCII(dst []byte, s string) []byte

Parameters & Attributes

NameTypeDescription
dst[]byteDestination byte slice; existing prefix is preserved.
sstringInput text to parse, inspect or quote.

Return Value

[]byte

Resulting byte slice, including original prefix.

Working Example

Example Snippetgo
package main
import (  "fmt"  "strconv")
func main() {  b := []byte("v=")  b = strconv.AppendQuoteToASCII(b, "é")  fmt.Println(string(b))}
Go Reference