Standard library / math/big
big.Int.UnmarshalText()
Parse textual integer input according to the method's accepted integer syntax; check errors. This method writes to the receiver (use a separate destination to preserve inputs when needed). Expected stdout: '255\n'.
Formal Syntax & Structure
go syntaxgo
func (z *Int) UnmarshalText(text []byte) errorParameters & Attributes
| Name | Type | Description |
|---|---|---|
| text | []byte | Encoded textual input. |
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) check(z.UnmarshalText([]byte("0xff"))) fmt.Println(z)}