Standard library / math/big

big.Int.Format()

Implement fmt.Formatter for integer verbs, prefixes, width and precision. Expected stdout: '0x002a\n'.

Formal Syntax & Structure

go syntaxgo
func (x *Int) Format(s fmt.State, ch rune)

Parameters & Attributes

NameTypeDescription
sfmt.StateText input or formatting/scanning state, according to the signature.
chruneFormat verb supplied by fmt.

Return Value

void

No return value; invoked by fmt.

Working Example

Example Snippetgo
package main
import (  "fmt"  "math/big")
func main() {  fmt.Printf("%#06x\n", big.NewInt(42))}
Go Reference