Standard library / encoding/hex
encoding/hex.EncodedLen()
Returns twice the byte length for allocating encoded output. Expected stdout: '6\n'.
Formal Syntax & Structure
go syntaxgo
func EncodedLen(n int) intParameters & Attributes
| Name | Type | Description |
|---|---|---|
| n | int | Length of input in bytes. |
Return Value
int
Number of bytes or required size, as described above.
Working Example
Example Snippetgo
package main
import ( "encoding/hex" "fmt")
func must(e error) { if e != nil { panic(e) }}
func main() { fmt.Println(hex.EncodedLen(3)) }