Standard library / encoding/hex

encoding/hex.AppendEncode()

Appends lower-case hexadecimal digits to a destination slice. Expected stdout: '!476f\n'.

Formal Syntax & Structure

go syntaxgo
func AppendEncode(dst, src []byte) []byte

Parameters & Attributes

NameTypeDescription
dst[]byteDestination byte slice; append APIs preserve its existing prefix.
src[]byteSource bytes to encode or decode.

Return Value

[]byte

Resulting byte slice.

Working Example

Example Snippetgo
package main
import (  "encoding/hex"  "fmt")
func must(e error) {  if e != nil {    panic(e)  }}
func main() { fmt.Println(string(hex.AppendEncode([]byte("!"), []byte("Go")))) }
Go Reference