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) errorParameters & Attributes
| Name | Type | Description |
|---|---|---|
| s | fmt.ScanState | Text input or formatting/scanning state, according to the signature. |
| ch | rune | Format 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)}