Standard library / strconv

strconv.AppendUint()

Appends unsigned integer in base 2–36 to dst. Returns the expanded slice; retain it even if the initial destination has enough capacity. Expected stdout: 'v=1f\n'.

Formal Syntax & Structure

go syntaxgo
func AppendUint(dst []byte, i uint64, base int) []byte

Parameters & Attributes

NameTypeDescription
dst[]byteDestination byte slice; existing prefix is preserved.
iuint64Integer value to encode.
baseintOutput radix 2–36.

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.AppendUint(b, 31, 16)  fmt.Println(string(b))}
Go Reference