The go language implements the method of encoding the string base64

  • 2020-05-26 09:19:08
  • OfStack

This article illustrates how the go language encodes the string base64. Share with you for your reference. The specific implementation method is as follows:

package main
import (
    "fmt"
    "encoding/base64"
)
func main() {
var b bytes.Buffer
w := base64.NewEncoder(base64.URLEncoding, &b)
w.Write(data)
w.Close()
data := b.Bytes()
}

I hope this article has been helpful to your programming of Go language.


Related articles: