Standard library / encoding/base64

encoding/base64.Encoding.DecodedLen()

Computes the maximum decoded byte length for the encoded input length, not necessarily the actual length. Expected stdout: '3\n'.

Formal Syntax & Structure

go syntaxgo
func (enc *Encoding) DecodedLen(n int) int

Parameters & Attributes

NameTypeDescription
nintLength of input in bytes.

Return Value

int

Number of bytes or required size, as described above.

Working Example

Example Snippetgo
package main
import (  "encoding/base64"  "fmt")
func must(e error) {  if e != nil {    panic(e)  }}
func main() { fmt.Println(base64.StdEncoding.DecodedLen(4)) }
Go Reference