Standard library / math/big
big.Int.Append()
Append the signed integer representation in base 2 through 62 to an existing byte slice. Expected stdout: 'hex=ff\n'.
Formal Syntax & Structure
go syntaxgo
func (x *Int) Append(buf []byte, base int) []byteParameters & Attributes
| Name | Type | Description |
|---|---|---|
| buf | []byte | Byte buffer or encoded data, as specified in the method contract. |
| base | int | Numeric radix; consult the accepted range. |
Return Value
[]byte
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(string(big.NewInt(255).Append([]byte("hex="), 16)))}