Standard library / math/big

big.Int.Scan()

Implement fmt.Scanner for integer verbs; check the number scanned and any error. This method writes to the receiver (use a separate destination to preserve inputs when needed). Expected stdout: '1 255\n'.

Formal Syntax & Structure

go syntaxgo
func (z *Int) Scan(s fmt.ScanState, ch rune) error

Parameters & Attributes

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

Return Value

error

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

Working Example

Example Snippetgo
package main
import (  "fmt"  "math/big")
func check(err error) {  if err != nil {    panic(err)  }}func main() {  z := new(big.Int)  n, e := fmt.Sscanf("ff", "%x", z)  check(e)  fmt.Println(n, z)}
Go Reference