Standard library / encoding/base32
encoding/base32.Encoding.DecodedLen()
Return a maximum decoded length suitable for allocating a buffer. Padding can make actual decoded output shorter. Expected stdout: '5 2\n'.
Formal Syntax & Structure
go syntaxgo
func (enc *Encoding) DecodedLen(n int) intParameters & Attributes
| Name | Type | Description |
|---|---|---|
| n | int | Number of input bytes. |
Return Value
int
Byte count or length bound, as specified by the operation.
Working Example
Example Snippetgo
package main
import ( "encoding/base32" "fmt")
func must(e error) { if e != nil { panic(e) }}
func main() { e := base32.StdEncoding v, err := e.DecodeString("I5XQ====") must(err) fmt.Println(e.DecodedLen(8), len(v))}