Standard library / math/big

big.Int.Text()

Format in base 2 through 62 without a prefix; bases above 36 distinguish letter case. Expected stdout: 'ff 11111111\n'.

Formal Syntax & Structure

go syntaxgo
func (x *Int) Text(base int) string

Parameters & Attributes

NameTypeDescription
baseintNumeric radix; consult the accepted range.

Return Value

string

Returns the result described above; see the example for the observed behavior.

Working Example

Example Snippetgo
package main
import (  "fmt"  "math/big")
func main() {  fmt.Println(big.NewInt(255).Text(16), big.NewInt(255).Text(2))}
Go Reference