Standard library / strconv

strconv.AppendQuoteRune()

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

Formal Syntax & Structure

go syntaxgo
func AppendQuoteRune(dst []byte, r rune) []byte

Parameters & Attributes

NameTypeDescription
dst[]byteDestination byte slice; existing prefix is preserved.
rruneUnicode code point to 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.AppendQuoteRune(b, 'a')  fmt.Println(string(b))}
Go Reference