Standard library / encoding/base32

encoding/base32.Encoding.DecodeString()

Decode Base32 text to bytes. Check the returned error before using the result; alphabet and padding must match the sender. Expected stdout: 'Go\n'.

Formal Syntax & Structure

go syntaxgo
func (enc *Encoding) DecodeString(s string) ([]byte, error)

Parameters & Attributes

NameTypeDescription
sstringEncoded Base32 text.

Return Value

([]byte, error)

Decoded bytes (possibly partial) and error.

Working Example

Example Snippetgo
package main
import (  "encoding/base32"  "fmt")
func must(e error) {  if e != nil {    panic(e)  }}
func main() { v, err := base32.StdEncoding.DecodeString("I5XQ===="); must(err); fmt.Println(string(v)) }
Go Reference