Standard library / encoding/base64
encoding/base64.Encoding.EncodedLen()
Computes output length including padding if configured. Expected stdout: '4 3\n'.
Formal Syntax & Structure
go syntaxgo
func (enc *Encoding) 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/base64" "fmt")
func must(e error) { if e != nil { panic(e) }}
func main() { fmt.Println(base64.StdEncoding.EncodedLen(2), base64.RawStdEncoding.EncodedLen(2)) }