Encoding.EncodeToString in Go

Posted by GoDoc
Public (Editable by Users)

EncodeToString returns the base64 encoding of src.

Go
Edit
package main

import (
	"encoding/base64"
	"fmt"
)

func main() {
	data := []byte("any + old & data")
	str := base64.StdEncoding.EncodeToString(data)
	fmt.Println(str)
}