2
我想在golang中解码简单的base64编码字符串。Golang将base64数据解码为字符串
package main
import b64 "encoding/base64"
import fmt
func main() {
data := "YmFzZTY0IGVuY29kZWQgc3RyaW5n"
sDec, err1 := b64.StdEncoding.DecodeString(data)
fmt.Println(sDec)
fmt.Println(err1)
}
和输出我得到的是
[98 97 115 101 54 52 32 101 110 99 111 100 101 100 32 115 116 114 105 110 103] // this is the decoded data.
<nil>
凡为https://www.base64decode.net/解码和输出 -
base64 encoded string
我如何在golang同样的结果?
看起来像那个方便的网站有一个golang演示https://www.base64decode.net/golang-decodestring –