Standard library / strconv

strconv.FormatUint()

Formats an unsigned uint64 in base 2–36 using lowercase digits; invalid bases panic. Expected stdout: '11111\n'.

Formal Syntax & Structure

go syntaxgo
func FormatUint(i uint64, base int) string

Parameters & Attributes

NameTypeDescription
iuint64Integer value to encode.
baseintOutput radix 2–36.

Return Value

string

Encoded representation.

Working Example

Example Snippetgo
package main
import (  "fmt"  "strconv")
func main() {  fmt.Println(strconv.FormatUint(31, 2))}
Go Reference